Skip to content

Commit 93876dc

Browse files
committed
Lab 12, task 2
1 parent 2b6d2b0 commit 93876dc

File tree

4 files changed

+45
-10
lines changed

4 files changed

+45
-10
lines changed

k8s/12.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Lab 12
2+
3+
## ConfigMap file
4+
5+
```sh
6+
$ helm install app-py . -f secrets://./env-secrets.yaml
7+
NAME: app-py
8+
LAST DEPLOYED: Mon Apr 22 16:55:16 2024
9+
NAMESPACE: default
10+
STATUS: deployed
11+
REVISION: 1
12+
NOTES:
13+
1. Get the application URL by running these commands:
14+
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
15+
You can watch the status of by running 'kubectl get --namespace default svc -w app-py'
16+
export SERVICE_IP=$(kubectl get svc --namespace default app-py --template "{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}")
17+
echo http://$SERVICE_IP:5000
18+
$ kubectl wait deployment/app-py --for condition=available
19+
deployment.apps/app-py condition met
20+
$ kubectl get po
21+
NAME READY STATUS RESTARTS AGE
22+
app-py-7d7d86657c-df667 1/1 Running 0 30s
23+
app-py-7d7d86657c-hq8nw 1/1 Running 0 30s
24+
app-py-7d7d86657c-jxgrj 1/1 Running 0 30s
25+
app-py-7d7d86657c-twd5l 1/1 Running 0 30s
26+
$ kubectl exec app-py-7d7d86657c-twd5l -- cat /persistent/config.json
27+
{"mole": ["hamsters"], "hamster": ["moles"]}
28+
$
29+
```

k8s/app-py/files/config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"mole": ["hamsters"], "hamster": ["moles"]}

k8s/app-py/templates/config_map.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: {{ .Release.Name }}-config-map
5+
data:
6+
config.json: {{ .Files.Get "files/config.json" | quote }}

k8s/app-py/values.yaml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ image:
44
repository: kolay0ne/app_py
55
pullPolicy: IfNotPresent
66
# Overrides the image tag whose default is the chart appVersion.
7-
tag: "lab8"
7+
tag: "lab12"
88

99
serviceAccount:
1010
# Specifies whether a service account should be created
@@ -84,17 +84,16 @@ autoscaling:
8484
# targetMemoryUtilizationPercentage: 80
8585

8686
# Additional volumes on the output Deployment definition.
87-
volumes: []
88-
# - name: foo
89-
# secret:
90-
# secretName: mysecret
91-
# optional: false
87+
volumes:
88+
- name: config-map
89+
configMap:
90+
name: app-py-config-map
9291

9392
# Additional volumeMounts on the output Deployment definition.
94-
volumeMounts: []
95-
# - name: foo
96-
# mountPath: "/etc/foo"
97-
# readOnly: true
93+
volumeMounts:
94+
- name: config-map
95+
mountPath: "/persistent"
96+
readOnly: true
9897

9998
nodeSelector: {}
10099

0 commit comments

Comments
 (0)