Skip to content

Commit

Permalink
add postgres pv & pvc kube yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
egcodes committed Apr 9, 2024
1 parent 6724248 commit 8601265
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 19 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
db/
util/
web/
nginx/server.pem
nginx/server.key
src/main/resources/credentials.txt
rsync.sh

HELP.md
target/
Expand Down
15 changes: 15 additions & 0 deletions kube-postgres-pv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: postgres-volume
labels:
type: local
app: postgres
spec:
storageClassName: manual
capacity:
storage: 25Gi
accessModes:
- ReadWriteMany
hostPath:
path: /data/postgresql
13 changes: 13 additions & 0 deletions kube-postgres-pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: postgres-volume-claim
labels:
app: postgres
spec:
storageClassName: manual
accessModes:
- ReadWriteMany
resources:
requests:
storage: 25Gi
37 changes: 19 additions & 18 deletions kube-postgres.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
spec:
selector:
app: postgres
type: NodePort
ports:
- protocol: TCP
port: 5432
Expand All @@ -17,7 +18,7 @@ kind: Deployment
metadata:
name: postgres
spec:
replicas: 1
replicas: 2
selector:
matchLabels:
app: postgres
Expand All @@ -27,21 +28,21 @@ spec:
app: postgres
spec:
containers:
- name: postgres
image: postgres:latest
ports:
- containerPort: 5432
volumeMounts:
- name: postgres-data
mountPath: /var/lib/postgresql/data
env:
- name: POSTGRES_PASSWORD
value: "12345678"
- name: POSTGRES_USER
value: "postgres"
- name: POSTGRES_DB
value: "hsw"
- name: postgres
image: postgres:latest
ports:
- containerPort: 5432
env:
- name: POSTGRES_PASSWORD
value: "12345678"
- name: POSTGRES_USER
value: "postgres"
- name: POSTGRES_DB
value: "hsw"
volumeMounts:
- name: postgresdata
mountPath: /var/lib/postgresql/data
volumes:
- name: postgres-data
emptyDir: {}

- name: postgresdata
persistentVolumeClaim:
claimName: postgres-volume-claim

0 comments on commit 8601265

Please sign in to comment.