postgres-deployment.yaml 905 B

12345678910111213141516171819202122232425262728293031
  1. apiVersion: apps/v1
  2. kind: Deployment # Create a deployment
  3. metadata:
  4. name: postgres # Set the name of the deployment
  5. namespace: postgres
  6. spec:
  7. replicas: 1 # Set 3 deployment replicas
  8. selector:
  9. matchLabels:
  10. app: postgres
  11. template:
  12. metadata:
  13. labels:
  14. app: postgres
  15. spec:
  16. containers:
  17. - name: postgres
  18. image: postgres:12.10 # Docker image
  19. imagePullPolicy: "IfNotPresent"
  20. ports:
  21. - containerPort: 5432 # Exposing the container port 5432 for PostgreSQL client connections.
  22. envFrom:
  23. - configMapRef:
  24. name: postgres-config # Using the ConfigMap postgres-secret
  25. volumeMounts:
  26. - mountPath: /var/lib/postgresql/data
  27. name: postgresdata
  28. volumes:
  29. - name: postgresdata
  30. persistentVolumeClaim:
  31. claimName: pg-pv-claim