34 lines
1.0 KiB
YAML
34 lines
1.0 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: postgres-deployment
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
component: postgres
|
|
template:
|
|
metadata:
|
|
labels:
|
|
component: postgres
|
|
spec:
|
|
volumes:
|
|
- name: postgres-storage
|
|
persistentVolumeClaim:
|
|
claimName: database-persistent-volume-claim
|
|
containers:
|
|
- name: postgres
|
|
image: postgres
|
|
ports:
|
|
- containerPort: 5432
|
|
volumeMounts:
|
|
- name: postgres-storage
|
|
mountPath: /var/lib/postgresql/data
|
|
subPath: postgres
|
|
env:
|
|
- name: PGPASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: pgpassword # Kubernetes wird nach dem Objekt Secret "pgpassword" suchen "k create secret generic pgpassword --from-literal PGPASSWORD=password123"
|
|
key: PGPASSWORD # In unserem Fall das Objekt Secret mit dem Namen "pgpassword" beinhaltet den Schlüssel PGPASSWORD mit dem Wert password123
|