Skip to content

Instantly share code, notes, and snippets.

@sandromello
Last active August 14, 2025 17:56
Show Gist options
  • Select an option

  • Save sandromello/b4948df3c26d44af9ca703e57e807e65 to your computer and use it in GitHub Desktop.

Select an option

Save sandromello/b4948df3c26d44af9ca703e57e807e65 to your computer and use it in GitHub Desktop.
Postgres Spec
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: postgres-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: postgres
spec:
replicas: 1
selector:
matchLabels:
app: postgres
strategy:
type: Recreate
template:
metadata:
labels:
app: postgres
spec:
containers:
- env:
- name: POSTGRES_USER
value: root
- name: POSTGRES_PASSWORD
value: 1a2b3c4d
- name: POSTGRES_DB
value: hoopdb
- name: PGDATA
value: /var/lib/postgresql/data/pgdata
image: postgres
name: postgres
ports:
- containerPort: 5432
name: pg
protocol: TCP
volumeMounts:
- name: postgres-storage
mountPath: /var/lib/postgresql/data
volumes:
- name: postgres-storage
persistentVolumeClaim:
claimName: postgres-pvc
---
apiVersion: v1
kind: Service
metadata:
name: postgres
spec:
ports:
- name: postgres
port: 5432
protocol: TCP
targetPort: 5432
selector:
app: postgres
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment