Files
SpecterOps-Nemesis/kubernetes/postgres/deployment.yaml
T
2023-10-04 01:07:30 -04:00

82 lines
1.9 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: postgres # Sets Deployment name
spec:
replicas: 1
selector:
matchLabels:
app: postgres
template:
metadata:
labels:
app: postgres
spec:
containers:
- name: postgres
image: postgres:15.1-alpine
imagePullPolicy: IfNotPresent
ports:
- containerPort: 5432 # Exposes container port
env:
- name: POSTGRES_DB
value: nemesis
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: postgres-creds
key: postgres-user
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: postgres-creds
key: postgres-password
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: postgredb
- name: postgres-nemesis-schema
mountPath: /docker-entrypoint-initdb.d/nemesis.sql
subPath: nemesis.sql
readOnly: true
volumes:
- name: postgres-nemesis-schema
configMap:
name: postgres-nemesis-schema
# Persistence
# Have data persist across runs (for prod)
- name: postgredb
persistentVolumeClaim:
claimName: postgres-pv-claim
---
kind: PersistentVolume
apiVersion: v1
metadata:
name: postgres-pv-volume
labels:
type: local
app: postgres
spec:
storageClassName: manual
capacity:
storage: 15Gi
accessModes:
- ReadWriteMany
hostPath:
path: "/mnt/data/postgres/"
# path: "/postgres-data/"
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: postgres-pv-claim
labels:
app: postgres
spec:
storageClassName: manual
accessModes:
- ReadWriteMany
resources:
requests:
storage: 15Gi
volumeName: postgres-pv-volume