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

34 lines
735 B
YAML

apiVersion: apps/v1
kind: StatefulSet
metadata:
name: todo-db
labels:
kiamol: ch08
spec:
selector:
matchLabels:
app: todo-db
serviceName: todo-db
replicas: 2
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"
volumes:
- name: secret
secret:
secretName: todo-db-secret
defaultMode: 0400
items:
- key: POSTGRES_PASSWORD
path: postgres_password