Created
October 23, 2021 09:08
-
-
Save alazycoder101/c972972d89caba9b79e0b196fd7e0374 to your computer and use it in GitHub Desktop.
pgpool deployment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: pgpool | |
labels: | |
app: pgpool | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
app: pgpool | |
template: | |
metadata: | |
labels: | |
app: pgpool | |
spec: | |
containers: | |
- name: pgpool | |
image: pgpool/pgpool | |
volumeMounts: | |
- name: pgpool-config | |
mountPath: /config | |
env: | |
- name: PGPASSWORD | |
valueFrom: | |
secretKeyRef: | |
name: pg-secret | |
key: superUserPassword | |
readinessProbe: | |
exec: | |
command: | |
- bash | |
- -ec | |
- psql -U postgres -h localhost -p 9999 -c "SELECT 1" | |
timeoutSeconds: 3 | |
initialDelaySeconds: 10 | |
periodSeconds: 5 | |
successThreshold: 1 | |
failureThreshold: 5 | |
livenessProbe: | |
exec: | |
command: | |
- bash | |
- -ec | |
- psql -U postgres -h localhost -p 9999 -c "SELECT 1" | |
timeoutSeconds: 3 | |
initialDelaySeconds: 30 | |
periodSeconds: 10 | |
successThreshold: 1 | |
failureThreshold: 5 | |
lifecycle: | |
preStop: | |
exec: | |
# 10 seconds to turn off nat forward from service | |
command: [ "sh", "-c", "sleep 10" ] | |
resources: | |
limits: | |
cpu: 1 | |
memory: 500Mi | |
requests: | |
cpu: 0.5 | |
memory: 300Mi | |
# complte current query 90 - 10 = 80 seconds to shutdown the connection | |
terminationGracePeriodSeconds: 90 | |
affinity: | |
podAntiAffinity: | |
preferredDuringSchedulingIgnoredDuringExecution: | |
- weight: 100 | |
podAffinityTerm: | |
labelSelector: | |
matchExpressions: | |
- key: app | |
operator: In | |
values: [ "pgpool" ] | |
topologyKey: kubernetes.io/hostname | |
volumes: | |
- name: pgpool-config | |
configMap: | |
name: pgpool-config | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: pgpool | |
spec: | |
selector: | |
app: pgpool | |
ports: | |
- name: pgpool-port | |
protocol: TCP | |
port: 9999 | |
targetPort: 9999 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment