Add postgres deployment for element
This commit is contained in:
parent
2a103b0da4
commit
e61e7654dc
75
k8s/postgres/postgres-deployment.yaml
Normal file
75
k8s/postgres/postgres-deployment.yaml
Normal file
|
@ -0,0 +1,75 @@
|
|||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: postgres
|
||||
namespace: postgres
|
||||
labels:
|
||||
k8s-app: postgres
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
k8s-app: postgres
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
k8s-app: postgres
|
||||
spec:
|
||||
containers:
|
||||
- name: postgresql
|
||||
image: postgres:17.0-bookworm
|
||||
env:
|
||||
- name: POSTGRES_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: postgres-secret
|
||||
key: postgres-password
|
||||
volumeMounts:
|
||||
- name: postgres-data
|
||||
mountPath: /var/lib/postgresql/data
|
||||
- name: sharemem
|
||||
mountPath: /dev/shm
|
||||
ports:
|
||||
- containerPort: 5432
|
||||
name: postgres
|
||||
protocol: TCP
|
||||
resources:
|
||||
requests:
|
||||
memory: "2Gi"
|
||||
cpu: "500m"
|
||||
limits:
|
||||
memory: "4Gi"
|
||||
cpu: "2000m"
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- /bin/bash
|
||||
- -c
|
||||
- exec pg_isready -U postgres -h 127.0.0.1 -p 5432
|
||||
failureThreshold: 6
|
||||
initialDelaySeconds: 20
|
||||
periodSeconds: 10
|
||||
successThreshold: 1
|
||||
timeoutSeconds: 5
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- /bin/bash
|
||||
- -c
|
||||
- exec pg_isready -U postgres -h 127.0.0.1 -p 5432
|
||||
failureThreshold: 6
|
||||
initialDelaySeconds: 20
|
||||
periodSeconds: 10
|
||||
successThreshold: 2
|
||||
timeoutSeconds: 5
|
||||
|
||||
volumes:
|
||||
- name: postgres-data
|
||||
persistentVolumeClaim:
|
||||
claimName: postgres-pvc
|
||||
readOnly: false
|
||||
- emptyDir:
|
||||
medium: Memory
|
||||
sizeLimit: 1Gi
|
||||
name: sharemem
|
7
k8s/postgres/postgres-namespace.yaml
Normal file
7
k8s/postgres/postgres-namespace.yaml
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: postgres
|
||||
labels:
|
||||
usage: postgres-btsystem
|
13
k8s/postgres/postgres-pvc.yaml
Normal file
13
k8s/postgres/postgres-pvc.yaml
Normal file
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: postgres-pvc
|
||||
namespace: postgres
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
resources:
|
||||
requests:
|
||||
storage: 20Gi
|
||||
storageClassName: rook-cephfs
|
14
k8s/postgres/postgres-service.yaml
Normal file
14
k8s/postgres/postgres-service.yaml
Normal file
|
@ -0,0 +1,14 @@
|
|||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: postgres
|
||||
namespace: postgres
|
||||
spec:
|
||||
selector:
|
||||
k8s-app: postgres
|
||||
ports:
|
||||
- name: postgres
|
||||
protocol: TCP
|
||||
port: 5432
|
||||
targetPort: 5432
|
Loading…
Reference in a new issue