Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example Postgres deployment, utilizing a configMap and secret
apiVersion: v1
data:
PGDATA: /var/lib/postgres
kind: ConfigMap
metadata:
name: postgres-env-vars
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: postgres
labels:
app: postgres
spec:
replicas: 1
selector:
matchLabels:
app: postgres
strategy:
type: Recreate
template:
metadata:
labels:
app: postgres
spec:
containers:
- image: library/postgres:9.6-alpine
name: postgres
readinessProbe:
tcpSocket:
port: 5432
initialDelaySeconds: 120
periodSeconds: 30
livenessProbe:
tcpSocket:
port: 5432
initialDelaySeconds: 120
periodSeconds: 30
env:
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: postgres-creds
key: POSTGRES_PASSWORD
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: postgres-creds
key: POSTGRES_USER
- name: POSTGRES_DB
valueFrom:
secretKeyRef:
name: postgres-creds
key: POSTGRES_DB
- name: PGDATA
valueFrom:
configMapKeyRef:
name: postgres-env-vars
key: PGDATA
ports:
- containerPort: 5432
name: postgres
apiVersion: v1
data:
POSTGRES_DB: dGVzdGRi
POSTGRES_PASSWORD: dGVzdHB3
POSTGRES_USER: dGVzdHVzZXI=
kind: Secret
metadata:
name: postgres-creds
type: Opaque
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.