deploy/model-postgres.yaml
KMLabz-TMIT Kubernetes 5b25ff6e2e modify resource
2020-08-02 15:25:28 +00:00

88 lines
1.7 KiB
YAML

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