postgres-deployment.yaml 970 B

12345678910111213141516171819202122232425262728293031323334353637
  1. apiVersion: apps/v1
  2. kind: Deployment
  3. metadata:
  4. name: postgres-mas
  5. spec:
  6. replicas: 1
  7. selector:
  8. matchLabels:
  9. app: postgres-mas
  10. template:
  11. metadata:
  12. labels:
  13. app: postgres-mas
  14. spec:
  15. initContainers:
  16. - name: init-database
  17. image: busybox
  18. command: ['sh', '-c', 'rm -rf /var/lib/postgresql/data/lost+found']
  19. volumeMounts:
  20. - mountPath: /var/lib/postgresql/data
  21. name: postgresdata-mas
  22. containers:
  23. - name: postgres
  24. image: 'postgres:14'
  25. imagePullPolicy: IfNotPresent
  26. ports:
  27. - containerPort: 5432
  28. envFrom:
  29. - configMapRef:
  30. name: postgres-mas-secret
  31. volumeMounts:
  32. - mountPath: /var/lib/postgresql/data
  33. name: postgresdata-mas
  34. volumes:
  35. - name: postgresdata-mas
  36. persistentVolumeClaim:
  37. claimName: postgres-mas-volume-claim