postgresql-server.yaml
3.26 KB
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
112
113
---
apiVersion: v1
kind: Service
metadata:
name: postgresql
spec:
selector:
app: postgresql-server
ports:
- name: mysql
protocol: TCP
port: 5432
targetPort: 5432
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: postgresql-server
labels:
app: postgresql-server
spec:
replicas: 1
progressDeadlineSeconds: 600
selector:
matchLabels:
app: postgresql-server
template:
metadata:
labels:
app: postgresql-server
spec:
restartPolicy: Always
securityContext:
runAsUser: 0
runAsGroup: 0
volumes:
- name: postgresql-data
persistentVolumeClaim:
claimName: postgresql-data
- name: postgresql-entrypoint-initdb
persistentVolumeClaim:
claimName: postgresql-entrypoint-initdb
- name: postgresql-scripts
configMap:
name: postgresql-scripts
defaultMode: 0755
- name: postgresql-config
configMap:
name: postgresql-config
- name: postgresql-secret
secret:
secretName: postgresql-secret
- name: database-restore
emptyDir: {}
- name: etc
emptyDir: {}
initContainers:
- name: wait-for-file
image: debian
command: ["/scripts/wait-for-file"]
volumeMounts:
- name: postgresql-entrypoint-initdb
mountPath: /docker-entrypoint-initdb.d
- name: postgresql-scripts
mountPath: /scripts
env:
- name: WAIT_FOR_FILE
value: /docker-entrypoint-initdb.d/.restored
- name: init-postgresql
image: postgresql
command: ["/var/scripts/bitnami-postgresql-entrypoint-initContainer.sh"]
volumeMounts:
- name: postgresql-scripts
mountPath: /var/scripts
- name: postgresql-data
mountPath: /bitnami/postgresql
- name: postgresql-config
mountPath: /var/postgresql-config
- name: postgresql-secret
mountPath: /var/postgresql-secret
- name: postgresql-entrypoint-initdb
mountPath: /docker-entrypoint-initdb.d
- name: etc
mountPath: /runtime-etc
env:
- name: POSTGRESQL_DATABASE_FILE
value: /var/postgresql-config/POSTGRESQL_DATABASE
- name: POSTGRESQL_USER_FILE
value: /var/postgresql-config/POSTGRESQL_USER
- name: POSTGRESQL_PASSWORD_FILE
value: /var/postgresql-secret/POSTGRESQL_PASSWORD
- name: POSTGRESQL_POSTGRES_PASSWORD_FILE
value: /var/postgresql-secret/POSTGRESQL_POSTGRES_PASSWORD
containers:
- name: postgresql
image: postgresql
#securityContext:
# runAsUser: 1001
# runAsGroup: 1001
command: ["/var/scripts/bitnami-postgresql-entrypoint-container.sh"]
args: ["/opt/bitnami/scripts/postgresql/run.sh"]
volumeMounts:
- name: postgresql-scripts
mountPath: /var/scripts
- name: postgresql-data
mountPath: /bitnami/postgresql
- name: etc
mountPath: /etc