kubernetes-yaml/learn/learn-kubernetes-master/kiamol/ch12/todo-list/db/todo-db.yaml

45 lines
1.1 KiB
YAML
Raw Normal View History

apiVersion: apps/v1
kind: Deployment
metadata:
name: todo-db
labels:
kiamol: ch12
spec:
selector:
matchLabels:
app: todo-db
template:
metadata:
labels:
app: todo-db
spec:
containers:
- name: db
image: postgres:11.6-alpine
env:
- name: POSTGRES_PASSWORD_FILE
value: /secrets/postgres_password
volumeMounts:
- name: secret
mountPath: "/secrets"
- name: data
mountPath: /var/lib/postgresql/data
readinessProbe:
tcpSocket:
port: 5432
periodSeconds: 5
livenessProbe:
exec:
command: ["pg_isready", "-h", "localhost"]
periodSeconds: 10
initialDelaySeconds: 10
volumes:
- name: secret
secret:
secretName: todo-db-secret
defaultMode: 0400
items:
- key: POSTGRES_PASSWORD
path: postgres_password
- name: data
emptyDir: {}