Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create a ConfigMap named app-config with a key APP_MODE set to production.
Kubernetes
kubectl create configmap app-config --from-literal=[1]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using spaces instead of '=' between key and value.
Using ':' or '=>' which are invalid here.
✗ Incorrect
The correct syntax to create a ConfigMap from a literal key-value pair is
--from-literal=KEY=VALUE.2fill in blank
mediumComplete the Pod YAML snippet to use the ConfigMap app-config as environment variables.
Kubernetes
envFrom:
- configMapRef:
name: [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using underscores instead of hyphens.
Changing the order of words in the name.
✗ Incorrect
The ConfigMap name must exactly match the created ConfigMap, which is
app-config.3fill in blank
hardFix the error in this environment variable definition to correctly reference the ConfigMap key APP_MODE.
Kubernetes
- name: APP_MODE
valueFrom:
configMapKeyRef:
name: app-config
key: [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase or camelCase instead of uppercase with underscores.
Misspelling the key name.
✗ Incorrect
The key name is case-sensitive and must match exactly as defined in the ConfigMap, which is
APP_MODE.4fill in blank
hardFill both blanks to complete the Pod spec that uses the ConfigMap app-config and sets the environment variable APP_MODE from the key APP_MODE.
Kubernetes
env: - name: [1] valueFrom: configMapKeyRef: name: [2] key: APP_MODE
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect env var names that don't match the key.
Using wrong ConfigMap names.
✗ Incorrect
The environment variable name should be
APP_MODE and the ConfigMap name is app-config.5fill in blank
hardFill all three blanks to complete the Pod spec that uses envFrom to load all keys from the ConfigMap app-config as environment variables.
Kubernetes
spec:
containers:
- name: myapp
image: myapp:latest
envFrom:
- [1]:
name: [2]
optional: [3] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using secretRef instead of configMapRef.
Setting optional to true when the ConfigMap is required.
✗ Incorrect
Use
configMapRef to reference the ConfigMap named app-config. The optional field is usually set to false to require the ConfigMap.