0
0
Kubernetesdevops~10 mins

Chart templates and values.yaml in Kubernetes - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to reference a value from values.yaml in a Helm template.

Kubernetes
image: {{ .Values.[1] }}
Drag options to blanks, or click blank then click option'
AcontainerPort
BreplicaCount
CimageName
DservicePort
Attempts:
3 left
💡 Hint
Common Mistakes
Using keys that refer to ports or counts instead of the image name.
Forgetting to use .Values before the key.
2fill in blank
medium

Complete the code to set the number of replicas from values.yaml in a Deployment template.

Kubernetes
replicas: {{ .Values.[1] }}
Drag options to blanks, or click blank then click option'
AreplicaCount
BimageName
CservicePort
DcontainerPort
Attempts:
3 left
💡 Hint
Common Mistakes
Using image-related keys instead of replica count.
Forgetting to use .Values prefix.
3fill in blank
hard

Fix the error in the template to correctly access the service port from values.yaml.

Kubernetes
port: {{ .Values.[1] }}
Drag options to blanks, or click blank then click option'
AcontainerPort
BreplicaCount
CimageName
DservicePort
Attempts:
3 left
💡 Hint
Common Mistakes
Using containerPort instead of servicePort for the service port.
Using keys unrelated to ports.
4fill in blank
hard

Fill both blanks to create a conditional block that checks if replicaCount is greater than 1.

Kubernetes
{{- if gt .Values.[1] [2] }}
replicas: {{ .Values.replicaCount }}
{{- end }}
Drag options to blanks, or click blank then click option'
AreplicaCount
B1
C0
DimageName
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong key for the first blank.
Using 0 or imageName instead of 1 for the second blank.
5fill in blank
hard

Fill all three blanks to define a container port using values from values.yaml.

Kubernetes
- name: app-container
  image: {{ .Values.[1] }}
  ports:
    - containerPort: {{ .Values.[2] }}
      protocol: [3]
Drag options to blanks, or click blank then click option'
AimageName
BcontainerPort
CTCP
DUDP
Attempts:
3 left
💡 Hint
Common Mistakes
Using servicePort instead of containerPort for the port.
Using UDP instead of TCP for the protocol.
Mixing keys for image and port.