Questions — Did You Understand Helm and Project 13?

17 min

Project projet13-kubernetes-helm-tp · 36 self-assessment questions

These questions are precisely about THIS project (chart/, values.yaml, values-dev.yaml, _helpers.tpl, apps/portail, the three outages). Answer before unfolding the solution. Correct answers are spread across A, B, C, and D.

Table of contents


A — Helm: basic ideas

1. In one sentence, what does Helm do?

  • A) It replaces Kubernetes: you no longer need kubectl
  • B) It generates Kubernetes manifests from templates and values, then applies them as a versioned unit
  • C) It builds Docker images instead of docker build
  • D) It is only used to install applications from the Internet
Answer

B. Helm renders YAML templates with variables (values.yaml), then applies the result in the cluster under the name of a release. kubectl remains essential to observe the cluster.

2. What is a Helm release?

  • A) A new version of the application's Python code
  • B) A signed Chart.yaml file
  • C) A concrete installation of a Chart, identified by a name (hedge-dev, hedge-staging, hedge-prod)
  • D) A Kubernetes namespace
Answer

C. The same Chart can be installed several times. Each installation is a release. The namespace is the isolation place; the release is the Helm object.

3. In this project, which statement is true?

  • A) {{ .Chart.Name }} changes on each helm install, {{ .Release.Name }} stays the same
  • B) {{ .Release.Name }} changes on each helm install, {{ .Chart.Name }} stays the same
  • C) Both stay the same
  • D) Both change on each helm upgrade
Answer

B. The Chart is always called hedge. The release name (hedge-dev, hedge-staging, hedge-prod) changes on each installation. This contrast is what enables multi-environment.

4. Which command produces the YAML without deploying anything in the cluster?

  • A) helm install
  • B) helm upgrade
  • C) helm lint
  • D) helm template
Answer

D. helm template is a dry render. helm lint checks the syntax, but does not display the manifests. install and upgrade touch the cluster.

5. What is a file whose name starts with _ in templates/ for (example: _helpers.tpl)?

  • A) Helm applies it first, before all the others
  • B) It produces a Kubernetes manifest named _helpers
  • C) It produces no manifest: it defines reusable functions (define / include)
  • D) It is completely ignored by Helm
Answer

C. The _ prefix means “helper only”. The functions are then called with {{ include "hedge.labels" ... }}.

6. In Chart.yaml, what is the difference between version and appVersion?

  • A) None: they are two aliases of the same field
  • B) version is the Chart version (Helm packaging); appVersion is the version of the deployed application
  • C) version is the Helm revision number; appVersion is the Docker tag
  • D) version is for Kubernetes; appVersion is for Helm
Answer

B. You can change version (for example 0.1.0 to 0.2.0) without changing the application code, and conversely. It is not the revision number (helm history), nor automatically the image tag.


B — Anatomy of the hedge Chart

7. In this project, what does the apps/ folder contain?

  • A) The Helm templates to complete
  • B) The Python code of the portail and the api, not to be modified
  • C) The three values-<env>.yaml files
  • D) The valider.ps1 script
Answer

B. You are the DevOps: the application code is already written. Modifying apps/ is forbidden by the lab rules.

8. Why is the chart/casses/ folder not inside chart/templates/?

  • A) Helm rejects files whose name starts with casse-
  • B) So that Helm does not load them automatically: you copy them one by one into templates/ to observe the bug
  • C) Kubernetes does not accept more than 5 files in templates/
  • D) These files are Docker images, not templates
Answer

B. Helm renders all files in templates/ (except those prefixed with _). Leaving the outages in casses/ avoids breaking the Chart before mission 6.

9. In this project's values.yaml, on which port does the portail container listen?

  • A) 80
  • B) 30130
  • C) 5000
  • D) 8000
Answer

C. portail.service.targetPort: 5000 (this is the Flask port). port: 80 is the Service port. nodePort: 30130 is the port exposed on the machine (DEV). 8000 is the api targetPort.

10. In this project, which Service type is planned for the api in values.yaml?

  • A) NodePort
  • B) LoadBalancer
  • C) ExternalName
  • D) ClusterIP
Answer

D. The api stays internal to the cluster. The portal calls it by DNS (http://hedge-dev-api). Only the portal is NodePort for the browser.

11. How many Docker images must you build once only before deploying the three environments?

  • A) One only (hedge:1.0)
  • B) Two (hedge-portail:1.0 and hedge-api:1.0)
  • C) Three (one per environment)
  • D) Six (two images × three environments)
Answer

B. The three environments reuse the same images. What changes is the injected values (color, replicas, message), not the code.

12. The portal displays a colored banner and a message. Where does this information come from?

  • A) It is hardcoded in apps/portail/app.py
  • B) It comes from environment variables injected by Helm from the Values
  • C) It is read from a couleur.txt file mounted as a volume
  • D) It is chosen at random by Flask at startup
Answer

B. app.py reads THEME_COLOR, BANNIERE_MESSAGE, ENVIRONMENT, etc. The same code adapts to DEV / STAGING / PROD without modification.


C — Templates, Values, and helpers

13. What does {{ .Values.portail.replicas }} render if values-prod.yaml contains portail.replicas: 3 and you install with -f values-prod.yaml?

  • A) 1 (values.yaml always wins)
  • B) 3 (the file passed with -f overrides values.yaml)
  • C) An error: you cannot have the same key twice
  • D) default
Answer

B. values.yaml provides the defaults. Each values-<env>.yaml overrides only what changes. That is the very principle of multi-environment.

14. Why is a values-prod.yaml file that redefines portail.image.repository a pedagogical error in this project?

  • A) Because the repository field does not exist
  • B) Because the image is identical in the three environments: this key has no reason to be copied again
  • C) Because Helm rejects more than 10 keys in a values file
  • D) Because the repository must be defined only in Chart.yaml
Answer

B. You only recopy in values-<env>.yaml what distinguishes the environment (replicas, nodePort, color, message, environment). Recopying the rest is going back to the copy-paste that Helm is supposed to replace.

15. In this project, the hedge.fullname helper must produce, for release hedge-dev and component portail:

  • A) hedge-portail
  • B) portail-hedge-dev
  • C) hedge-dev-portail
  • D) hedge
Answer

C. Format <release>-<composant>. This prefix is what avoids name collisions between DEV, STAGING, and PROD (and even in the same namespace).

16. Which labels must alone appear in hedge.selectorLabels?

  • A) name, instance, component — the three that will never change for this instance
  • B) All labels of hedge.labels, including version and hedge/environment
  • C) Only hedge/environment
  • D) Only helm.sh/chart
Answer

A. spec.selector.matchLabels is immutable. Putting version, helm.sh/chart, or hedge/environment there will fail the first helm upgrade that changes these values.

17. Why can the portal's BACKEND_URL not be hardcoded as http://api?

  • A) Because Flask rejects URLs without a port number
  • B) Because the Service is called hedge-<release>-api (e.g. hedge-dev-api): the DNS name depends on the release
  • C) Because the api has no Service
  • D) Because the portal never calls the api
Answer

B. The hedge.fullname helper builds hedge-dev-api, hedge-staging-api, hedge-prod-api. A hardcoded name api resolves nothing in the namespace.

18. What does {{ .Values.environment | quote }} do?

  • A) It converts the value to an integer
  • B) It adds quotes around the rendered value (required for a YAML string)
  • C) It displays the value in uppercase
  • D) It ignores the value if it is empty
Answer

B. quote produces "dev" rather than dev. Without quotes, some YAML values (hex colors, messages) can break the manifest.

19. Why is replicas: "{{ .Values.portail.replicas }}" (with quotes around the whole template) dangerous?

  • A) Helm rejects quotes in a Deployment
  • B) Kubernetes expects an integer; the render becomes the string "1", which the API rejects
  • C) The value will always be 0
  • D) The quotes multiply the number of replicas by two
Answer

B. Never quote an integer. You write replicas: {{ .Values.portail.replicas }}, not replicas: "{{ ... }}".

20. What is nindent 4 for in {{ include "hedge.labels" ... | nindent 4 }}?

  • A) To limit the helper to 4 labels
  • B) To indent the rendered YAML correctly (otherwise the manifest is unreadable or invalid)
  • C) To create 4 replicas
  • D) To wait 4 seconds before the render
Answer

B. Helm injects a multi-line block. Without nindent, YAML indentation breaks and you get error converting YAML to JSON.


D — The three environments

21. In this project, which nodePort is reserved for STAGING?

  • A) 30130
  • B) 30131
  • C) 30132
  • D) 30500
Answer

B. DEV = 30130, STAGING = 30131, PROD = 30132. 30500 is the project 12 portal, not this one.

22. How many portail + api replicas must you have in PROD once the Chart is correctly deployed?

  • A) 1 + 1
  • B) 2 + 2
  • C) 3 + 3
  • D) 5 + 1
Answer

C. PROD: 3 portals and 3 apis. DEV: 1+1. STAGING: 2+2. In total, 12 application Pods side by side.

23. Which banner color corresponds to the DEV environment?

  • A) Orange #ea580c
  • B) Green #16a34a
  • C) Gray #64748b
  • D) Blue #2563eb
Answer

D. Blue = DEV, orange = STAGING, green = PROD. Gray #64748b is the default color of values.yaml (default environment), not that of one of the three environment files.

24. Why deploy each environment in its own namespace (hedge-dev, hedge-staging, hedge-prod)?

  • A) Helm rejects two releases in the same namespace, even with different names
  • B) To isolate objects, avoid internal NodePort collisions, and match company reality (one namespace per environment)
  • C) Because Docker Desktop allows only one namespace
  • D) Because values.yaml requires it
Answer

B. Helm allows several releases in the same namespace (that is actually the trap of outage 1 if names are hardcoded). Namespaces remain the best practice: isolation, quotas, RBAC, clarity.

25. Which command correctly installs the DEV environment of this project?

  • A) kubectl apply -f chart/environments/values-dev.yaml
  • B) helm install hedge-dev .\chart -f .\chart\environments\values-dev.yaml -n hedge-dev --create-namespace
  • C) helm template hedge-dev .\chart
  • D) docker compose up -d
Answer

B. You point to the Chart (.\chart), override with -f values-dev.yaml, name the release hedge-dev, create the namespace. helm template deploys nothing. values-dev.yaml is not a kubectl manifest.

26. If you open http://localhost:30132 and the banner is green, what do you necessarily see in the /api-json JSON?

  • A) "env": "dev"
  • B) "env": "staging"
  • C) "env": "prod" and "backend": "ok" if the api of the same namespace answers
  • D) "env": "default"
Answer

C. Port 30132 is the PROD one. The env field comes from .Values.environment. backend: ok proves that BACKEND_URL points to the api Service of this release.


E — install, upgrade, rollback

27. After helm install hedge-dev ... then helm upgrade hedge-dev ... --set portail.replicas=5, what does helm history hedge-dev -n hedge-dev show?

  • A) A single revision: Helm overwrites the history
  • B) At least two revisions: 1 = Install, 2 = Upgrade
  • C) Zero revisions: history only exists after a rollback
  • D) Only revision 5, because replicas is 5
Answer

B. Each install / upgrade / rollback creates a revision. This journal is what makes rollback possible.

28. What does helm rollback hedge-dev 1 -n hedge-dev do?

  • A) Deletes the release
  • B) Re-applies the state of revision 1 and creates a new revision (often #3) described as Rollback to 1
  • C) Goes back to the Git code of the first commit
  • D) Resets values.yaml to zero on disk
Answer

B. Rollback does not erase history: it adds a revision. values-dev.yaml on your disk does not change.

29. What is the fundamental difference between helm upgrade --set portail.replicas=5 and kubectl scale deploy/hedge-dev-portail --replicas=5?

  • A) None: both do exactly the same thing
  • B) kubectl scale is slower
  • C) helm upgrade is traced and reversible by Helm; kubectl scale leaves Helm's control and will be overwritten on the next upgrade without --set
  • D) kubectl scale is forbidden by Kubernetes on an object created by Helm
Answer

C. Helm reconverges to the Values on the next upgrade. A manual change (scale, edit) is invisible debt. That is the reflection question of mission 5.

30. Does helm uninstall hedge-dev -n hedge-dev delete the hedge-dev namespace?

  • A) Yes, always
  • B) No: it removes the release objects, not the namespace (unless you then delete it with kubectl delete namespace)
  • C) Yes, but only if the namespace is empty
  • D) No, and the Deployments stay in place
Answer

B. uninstall removes the release Deployment, Service, etc. The namespace survives. Hence the README cleanup command: kubectl delete namespace hedge-dev ....

31. What happens if you run kubectl delete pod hedge-dev-portail-xxxxx -n hedge-dev on a Pod created by the Helm Deployment?

  • A) The Pod disappears permanently; Helm displays an error
  • B) The Deployment immediately recreates a Pod; Helm has nothing to “know”: it manages the Deployment, not each Pod
  • C) All Pods in the namespace are killed
  • D) Helm automatically launches a rollback
Answer

B. Helm declares the Deployment. Kubernetes maintains the number of replicas. Deleting a Pod is the pedagogical self-healing gesture, not a Helm outage.


F — The project's three outages

32. Outage 1 (casse-1-configmap.yaml): why does the second release in the same namespace fail?

  • A) Because Helm allows only one release per cluster
  • B) Because metadata.name: hedge-config is a static name: the two releases fight over the same object
  • C) Because the ConfigMap has no data
  • D) Because values-staging.yaml is invalid
Answer

B. The fix is to prefix the name with the release: {{ include "hedge.fullname" (dict "root" . "composant" "config") }} produces hedge-dev-config and hedge-staging-config.

33. Outage 2 (casse-2-worker-deployment.yaml): which Kubernetes message do you see on helm upgrade --set environment=recette?

  • A) nil pointer evaluating interface {}.replicas
  • B) ConfigMap "hedge-config" exists and cannot be imported
  • C) spec.selector: Invalid value: ...: field is immutable
  • D) ImagePullBackOff
Answer

C. hedge/environment is in matchLabels. Changing environment changes the selector, which Kubernetes rejects. A and B are the symptoms of outages 3 and 1.

34. In a Deployment, where are you allowed to put the hedge/environment label?

  • A) Only in spec.selector.matchLabels
  • B) In the Pod labels (template.metadata.labels) and the object labels, not in matchLabels
  • C) Nowhere: this label is forbidden by Kubernetes
  • D) Only in Chart.yaml
Answer

B. Pod labels can be rich and variable. The selector must remain a stable subset. That is the whole hedge.labels vs hedge.selectorLabels distinction.

35. Outage 3 (casse-3-cache-deployment.yaml): what does the error nil pointer evaluating interface {}.replicas on .Values.portal.replicas mean?

  • A) The cluster has no more RAM
  • B) The path is wrong: values.yaml defines portail (with an i), not portal — Helm evaluates nil.replicas
  • C) You must write .Release.portal.replicas
  • D) The replicas field is forbidden in a Deployment created by Helm
Answer

B. One extra letter. First reflex: helm template --debug and read the path in the error message.

36. You must add a 4th pre-prod environment tomorrow. Which files do you create, which ones do you not touch?

  • A) You duplicate the entire chart/ folder and rename the Chart
  • B) You create only chart/environments/values-preprod.yaml (and a helm install + namespace); the templates and values.yaml stay unchanged
  • C) You add a 4th hardcoded Deployment in templates/
  • D) You modify apps/portail/app.py to recognize pre-prod
Answer

B. That is Helm's promise: one Chart, N values files. If you must touch the templates for a new environment, the Chart is poorly designed.


Recap answer key

#AnswerIdea to remember
1BHelm = templates + values + release
2CA release = a named installation
3B.Release.Name changes, .Chart.Name does not
4Dhelm template = dry render
5C_helpers.tpl creates no object
6Bversion = Chart; appVersion = app
7Bapps/ is frozen
8Bcasses/ outside templates/ on purpose
9CPortal container = port 5000
10Dapi = ClusterIP
11BTwo images, three environments
12BColor and message come from Helm env vars
13B-f overrides values.yaml
14BRecopy only what differs
15Chedge-dev-portail
16ASelector = name + instance + component
17BBACKEND_URL must include the release name
18Bquote = YAML quotes
19BNever quote an integer replicas
20Bnindent saves indentation
21BSTAGING = 30131
22CPROD = 3 + 3
23DDEV = blue #2563eb
24BOne namespace per environment
25Bhelm install ... -f values-dev.yaml -n hedge-dev
26C30132 = prod + backend ok
27BHistory accumulates revisions
28BRollback = new revision
29Cscale outside Helm will be overwritten
30Buninstall does not kill the namespace
31BDelete pod = Deployment self-healing
32BHardcoded name = collision between releases
33CImmutable selector
34BVariable label OK on the Pod, forbidden in matchLabels
35BTypo portal / portail
36BA new env = a values file

Indicative score: 30/36 or more = you can explain the project to a classmate. Below 24/36, reread the “Essential concepts”, “Mission 3”, and “Mission 6” sections of 00-ENONCE.md.


Course created by Dr. Haythem REHOUMA — Development and Deployment of Data Solutions