-
Notifications
You must be signed in to change notification settings - Fork 4
/
statefullset.yaml
112 lines (110 loc) · 3.39 KB
/
statefullset.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: postgresql-1600344618
labels:
helm.sh/chart: postgresql-0.1.0
app.kubernetes.io/name: postgresql
app.kubernetes.io/instance: postgresql-1600344618
app.kubernetes.io/version: "9.6"
app.kubernetes.io/managed-by: Helm
snappyflow/appname: <appName>
snappyflow/projectname: <projectName>
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: postgresql
app.kubernetes.io/instance: postgresql-1600344618
serviceName: postgresql
template:
metadata:
labels:
app.kubernetes.io/name: postgresql
app.kubernetes.io/instance: postgresql-1600344618
snappyflow/component: postgresql
snappyflow/appname: <appName>
snappyflow/projectname: <projectName>
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "9187"
spec:
serviceAccountName: default
securityContext:
{}
containers:
# Prometheus exporter container for postgresql
- name: postgres-exporter
image: bitnami/postgres-exporter
ports:
- name: pg-exporter
containerPort: 9187
command: ["/bin/sh", "-c"]
args: ['DATA_SOURCE_NAME="postgresql://postgres:rootPassword@hostIP:hostPort/dbname?sslmode=disable" /opt/bitnami/postgres-exporter/bin/postgres_exporter']
# Postgres DB container which is configured to write logs to stdout
- name: postgresql
securityContext:
{}
image: "postgres:9.6"
args: ["-c", "log_statement=all","-c","log_line_prefix=< %m >"]
imagePullPolicy: IfNotPresent
env:
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: postgresql-1600344618
key: rootPassword
- name: PG_MULTI_DB_PASSWORD
valueFrom:
secretKeyRef:
name: postgresql-1600344618
key: multidbUserPassword
- name: POSTGRES_USER
value: postgres
- name: PG_MULTI_DB_USER
value: data
- name: PG_MULTI_DB
value: db1;db2
- name: PGDATA
value: "/data/pgdata"
ports:
- name: tcp
containerPort: 5432
protocol: TCP
readinessProbe:
exec:
command:
- sh
- -c
- "pg_isready -U ${POSTGRES_USER}"
initialDelaySeconds: 30
timeoutSeconds: 5
livenessProbe:
exec:
command:
- sh
- -c
- "pg_isready -U ${POSTGRES_USER}"
initialDelaySeconds: 30
periodSeconds: 30
timeoutSeconds: 5
volumeMounts:
- name: data
mountPath: /data
subPath: pgdata
- name: initconfig
mountPath: /docker-entrypoint-initdb.d
resources:
limits:
cpu: 500m
memory: 500Mi
requests:
cpu: 100m
memory: 128Mi
volumes:
- name: data
persistentVolumeClaim:
claimName: postgresql-1600344618
- name: initconfig
configMap:
name: postgresql-1600344618-init