Skip to content

Commit b7b526f

Browse files
committed
Add secret configuration for chapter 11
1 parent 30c6006 commit b7b526f

File tree

2 files changed

+35
-5
lines changed

2 files changed

+35
-5
lines changed

ch11/kubernetes/thoughts_backend/deployment.yaml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,27 @@ spec:
2929
value: thoughts
3030
- name: POSTGRES_USER
3131
value: postgres
32-
- name: POSTGRES_PASSWORD
33-
value: somepassword
3432
- name: POSTGRES_PORT
3533
value: "5432"
3634
- name: POSTGRES_HOST
3735
value: "127.0.0.1"
36+
- name: POSTGRES_PASSWORD
37+
valueFrom:
38+
secretKeyRef:
39+
name: thoughts-secrets
40+
key: postgres-password
41+
volumeMounts:
42+
- name: public-key
43+
mountPath: "/opt/keys/"
44+
3845

3946
- name: thoughts-backend-db
4047
image: thoughts_backend_db:latest
4148
imagePullPolicy: Never
49+
volumes:
50+
- name: public-key
51+
secret:
52+
secretName: thoughts-secrets
53+
items:
54+
- key: public_key.pub
55+
path: public_key.pub

ch11/kubernetes/users_backend/deployment.yaml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,37 @@ spec:
2121
image: users_server:v2.3
2222
imagePullPolicy: Never
2323
ports:
24-
- containerPort: 8000
24+
- containerPort: 8000
2525
env:
2626
- name: DATABASE_ENGINE
2727
value: POSTGRESQL
2828
- name: POSTGRES_DB
2929
value: thoughts
3030
- name: POSTGRES_USER
3131
value: postgres
32-
- name: POSTGRES_PASSWORD
33-
value: somepassword
3432
- name: POSTGRES_PORT
3533
value: "5432"
3634
- name: POSTGRES_HOST
3735
value: "127.0.0.1"
36+
- name: POSTGRES_PASSWORD
37+
valueFrom:
38+
secretKeyRef:
39+
name: thoughts-secrets
40+
key: postgres-password
41+
volumeMounts:
42+
- name: sign-keys
43+
mountPath: "/opt/keys/"
3844

3945
- name: users-backend-db
4046
image: users_backend_db:latest
4147
imagePullPolicy: Never
48+
49+
volumes:
50+
- name: sign-keys
51+
secret:
52+
secretName: thoughts-secrets
53+
items:
54+
- key: public_key.pub
55+
path: public_key.pub
56+
- key: private_key.pem
57+
path: private_key.pem

0 commit comments

Comments
 (0)