apiVersion: apps/v1 kind: Deployment metadata: name: pgbouncer-db-10-14-seq-postgres1 namespace: default labels: app: pgbouncer-db-10-14-seq-postgres1 spec: revisionHistoryLimit: 10 # removes old replicasets for deployment rollbacks strategy: rollingUpdate: maxUnavailable: 0 # Avoid Terminating and ContainerCreating at the same time selector: matchLabels: app: pgbouncer-db-10-14-seq-postgres1 template: metadata: labels: app: pgbouncer-db-10-14-seq-postgres1 spec: # Optional: keep the POD close to the apps: #nodeSelector: # purpose: apps containers: - name: pgbouncer #image: 448389607377.dkr.ecr.us-west-2.amazonaws.com/pgb-dd:0.1 image: edoburu/pgbouncer:1.9.0 #imagePullPolicy: Always ports: - containerPort: 5432 volumeMounts: - name: configfiles mountPath: "/etc/pgbouncer" readOnly: true # writes update the secret! livenessProbe: tcpSocket: port: 5432 periodSeconds: 60 lifecycle: preStop: exec: # Allow existing queries clients to complete within 120 seconds command: ["/bin/sh", "-c", "killall -INT pgbouncer && sleep 120"] securityContext: allowPrivilegeEscalation: false capabilities: drop: ['all'] volumes: - name: configfiles secret: secretName: pgbouncer-multi-user-config