-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathpostgres.yaml
46 lines (46 loc) · 1.21 KB
/
postgres.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
apiVersion: v1
kind: Service
metadata:
name: my-postgres # name of our services
labels:
app: postgres
spec:
type: LoadBalancer # expose the service as loadbalancer, see kubernetes docs
ports:
- port: 5432
selector:
app: postgres
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-postgres #name of our deployments
labels:
app: postgres
spec:
selector:
matchLabels:
app: postgres #deploy that match our selector labels
tier: postgresql
replicas: 1 # number of replica set
template:
metadata:
labels:
app: postgres # our postgres container label
tier: postgresql
spec:
containers:
- name: my-postgres
image: postgres:10.7
ports:
- containerPort: 5432 # expose container port
envFrom:
- configMapRef:
name: my-postgres-config # get env value from config map
volumeMounts:
- mountPath: /var/lib/postgresql/data # mount point of do pv
name: my-postgres-volume # name of our mount point pv
volumes:
- name: my-postgres-volume
persistentVolumeClaim:
claimName: csi-pvc # name of pv created in pvc.yaml