Skip to content

Commit

Permalink
Lab 12, task 2
Browse files Browse the repository at this point in the history
  • Loading branch information
kolayne committed Apr 22, 2024
1 parent 2b6d2b0 commit 93876dc
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 10 deletions.
29 changes: 29 additions & 0 deletions k8s/12.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Lab 12

## ConfigMap file

```sh
$ helm install app-py . -f secrets://./env-secrets.yaml
NAME: app-py
LAST DEPLOYED: Mon Apr 22 16:55:16 2024
NAMESPACE: default
STATUS: deployed
REVISION: 1
NOTES:
1. Get the application URL by running these commands:
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace default svc -w app-py'
export SERVICE_IP=$(kubectl get svc --namespace default app-py --template "{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}")
echo http://$SERVICE_IP:5000
$ kubectl wait deployment/app-py --for condition=available
deployment.apps/app-py condition met
$ kubectl get po
NAME READY STATUS RESTARTS AGE
app-py-7d7d86657c-df667 1/1 Running 0 30s
app-py-7d7d86657c-hq8nw 1/1 Running 0 30s
app-py-7d7d86657c-jxgrj 1/1 Running 0 30s
app-py-7d7d86657c-twd5l 1/1 Running 0 30s
$ kubectl exec app-py-7d7d86657c-twd5l -- cat /persistent/config.json
{"mole": ["hamsters"], "hamster": ["moles"]}
$
```
1 change: 1 addition & 0 deletions k8s/app-py/files/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"mole": ["hamsters"], "hamster": ["moles"]}
6 changes: 6 additions & 0 deletions k8s/app-py/templates/config_map.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-config-map
data:
config.json: {{ .Files.Get "files/config.json" | quote }}
19 changes: 9 additions & 10 deletions k8s/app-py/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ image:
repository: kolay0ne/app_py
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: "lab8"
tag: "lab12"

serviceAccount:
# Specifies whether a service account should be created
Expand Down Expand Up @@ -84,17 +84,16 @@ autoscaling:
# targetMemoryUtilizationPercentage: 80

# Additional volumes on the output Deployment definition.
volumes: []
# - name: foo
# secret:
# secretName: mysecret
# optional: false
volumes:
- name: config-map
configMap:
name: app-py-config-map

# Additional volumeMounts on the output Deployment definition.
volumeMounts: []
# - name: foo
# mountPath: "/etc/foo"
# readOnly: true
volumeMounts:
- name: config-map
mountPath: "/persistent"
readOnly: true

nodeSelector: {}

Expand Down

0 comments on commit 93876dc

Please sign in to comment.