add cnc postgres

This commit is contained in:
Torma Kristóf 2020-08-06 17:12:14 +02:00
parent ebe717f874
commit 7dbfe61672
Signed by: tormakris
GPG Key ID: DC83C4F2C41B1047

87
cnc-postgres.yaml Normal file
View File

@ -0,0 +1,87 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: birbnetes-nfs-cnc-postgres
namespace: birbnetes
spec:
capacity:
storage: 10Gi
accessModes:
- ReadWriteMany
persistentVolumeReclaimPolicy: Recycle
nfs:
server: 192.168.100.1
path: /srv/kubedata/birbnetes/cnc-postgres
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: cnc-postgres-pv-claim
labels:
app: cnc-postgres
namespace: birbnetes
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 10Gi
---
apiVersion: v1
kind: ConfigMap
metadata:
name: cnc-postgres-config
labels:
app: cnc-postgres
namespace: birbnetes
data:
POSTGRES_DB: cnc-service
POSTGRES_USER: cnc-service
POSTGRES_PASSWORD: cnc-service-supersecret
PGDATA: /var/lib/postgresql/data/pgdata
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: cnc-postgres
namespace: birbnetes
spec:
replicas: 1
selector:
matchLabels:
app: cnc-postgres
template:
metadata:
labels:
app: cnc-postgres
spec:
containers:
- name: cnc-postgres
image: postgres:12
imagePullPolicy: "IfNotPresent"
ports:
- containerPort: 5432
envFrom:
- configMapRef:
name: cnc-postgres-config
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: cnc-postgredb
volumes:
- name: cnc-postgredb
persistentVolumeClaim:
claimName: cnc-postgres-pv-claim
---
apiVersion: v1
kind: Service
metadata:
name: cnc-postgres
namespace: birbnetes
spec:
type: ClusterIP
ports:
- port: 5432
targetPort: 5432
protocol: TCP
selector:
app: cnc-postgres