forked from mtusi2026/mtusi2026lab3
Prepare verified laboratory 3 implementation and evidence
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata: {name: postgres}
|
||||
spec:
|
||||
accessModes: [ReadWriteOnce]
|
||||
resources: {requests: {storage: 1Gi}}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata: {name: valkey}
|
||||
spec:
|
||||
accessModes: [ReadWriteOnce]
|
||||
resources: {requests: {storage: 1Gi}}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata: {name: postgres}
|
||||
spec:
|
||||
selector: {app: postgres}
|
||||
ports: [{port: 5432, targetPort: 5432}]
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata: {name: valkey}
|
||||
spec:
|
||||
selector: {app: valkey}
|
||||
ports: [{port: 6379, targetPort: 6379}]
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata: {name: postgres}
|
||||
spec:
|
||||
replicas: 1
|
||||
strategy: {type: Recreate}
|
||||
selector: {matchLabels: {app: postgres}}
|
||||
template:
|
||||
metadata: {labels: {app: postgres}}
|
||||
spec:
|
||||
automountServiceAccountToken: false
|
||||
terminationGracePeriodSeconds: 20
|
||||
containers:
|
||||
- name: postgres
|
||||
image: vp-postgres:local
|
||||
imagePullPolicy: Never
|
||||
env:
|
||||
- {name: POSTGRES_USER, value: messenger}
|
||||
- {name: POSTGRES_DB, value: messenger}
|
||||
- {name: POSTGRES_PASSWORD_FILE, value: /run/secrets/pg_password}
|
||||
resources:
|
||||
requests: {cpu: 100m, memory: 128Mi}
|
||||
limits: {cpu: '2', memory: 768Mi}
|
||||
readinessProbe:
|
||||
exec: {command: [pg_isready, -h, 127.0.0.1, -U, messenger, -d, messenger]}
|
||||
periodSeconds: 2
|
||||
volumeMounts:
|
||||
- {name: data, mountPath: /var/lib/postgresql}
|
||||
- {name: credentials, mountPath: /run/secrets, readOnly: true}
|
||||
volumes:
|
||||
- {name: data, persistentVolumeClaim: {claimName: postgres}}
|
||||
- name: credentials
|
||||
secret:
|
||||
secretName: app-config
|
||||
items: [{key: pg_password, path: pg_password}]
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata: {name: valkey}
|
||||
spec:
|
||||
replicas: 1
|
||||
strategy: {type: Recreate}
|
||||
selector: {matchLabels: {app: valkey}}
|
||||
template:
|
||||
metadata: {labels: {app: valkey}}
|
||||
spec:
|
||||
automountServiceAccountToken: false
|
||||
terminationGracePeriodSeconds: 10
|
||||
containers:
|
||||
- name: valkey
|
||||
image: vp-valkey:local
|
||||
imagePullPolicy: Never
|
||||
command: [valkey-server, /run/secrets/valkey_conf]
|
||||
resources:
|
||||
requests: {cpu: 50m, memory: 32Mi}
|
||||
limits: {cpu: 250m, memory: 128Mi}
|
||||
readinessProbe:
|
||||
tcpSocket: {port: 6379}
|
||||
periodSeconds: 2
|
||||
volumeMounts:
|
||||
- {name: data, mountPath: /data}
|
||||
- {name: credentials, mountPath: /run/secrets, readOnly: true}
|
||||
volumes:
|
||||
- {name: data, persistentVolumeClaim: {claimName: valkey}}
|
||||
- name: credentials
|
||||
secret:
|
||||
secretName: app-config
|
||||
items: [{key: valkey_conf, path: valkey_conf}]
|
||||
Reference in New Issue
Block a user