58 lines
1.2 KiB
YAML
58 lines
1.2 KiB
YAML
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: todo-db
|
|
namespace: kiamol-ch14-test
|
|
spec:
|
|
ports:
|
|
- port: 5432
|
|
targetPort: 5432
|
|
selector:
|
|
app: todo-db
|
|
---
|
|
apiVersion: v1
|
|
kind: Secret
|
|
metadata:
|
|
name: todo-db-secret
|
|
namespace: kiamol-ch14-test
|
|
type: Opaque
|
|
stringData:
|
|
POSTGRES_PASSWORD: "kiamol-2*2*"
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: todo-db
|
|
namespace: kiamol-ch14-test
|
|
spec:
|
|
selector:
|
|
matchLabels:
|
|
app: todo-db
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: todo-db
|
|
annotations:
|
|
prometheus.io/scrape: "false"
|
|
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
|
|
volumes:
|
|
- name: secret
|
|
secret:
|
|
secretName: todo-db-secret
|
|
defaultMode: 0400
|
|
items:
|
|
- key: POSTGRES_PASSWORD
|
|
path: postgres_password
|
|
- name: data
|
|
emptyDir: {} |