Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to define a ConfigMap named app-config.
Kubernetes
apiVersion: v1
kind: ConfigMap
metadata:
name: [1]
data:
key1: value1
key2: value2 Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different name than 'app-config' causes the mount to fail.
Misspelling the name in metadata.
✗ Incorrect
The ConfigMap must be named 'app-config' as specified.
2fill in blank
mediumComplete the volume definition to mount the ConfigMap named app-config.
Kubernetes
volumes:
- name: config-volume
[1]:
name: app-config Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'secret' instead of 'configMap' causes errors.
Using 'emptyDir' mounts an empty directory, not the ConfigMap.
✗ Incorrect
To mount a ConfigMap as a volume, use the 'configMap' field.
3fill in blank
hardFix the error in the container volumeMounts to mount the volume at /etc/config.
Kubernetes
containers:
- name: app-container
image: nginx
volumeMounts:
- name: config-volume
mountPath: [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different path causes the app to not find the config files.
Typos in the mountPath cause mount failures.
✗ Incorrect
The mountPath must be exactly '/etc/config' to match the requirement.
4fill in blank
hardFill both blanks to complete the pod spec that mounts the ConfigMap volume and uses it in the container.
Kubernetes
spec:
containers:
- name: app
image: busybox
volumeMounts:
- name: [1]
mountPath: [2]
volumes:
- name: config-volume
configMap:
name: app-config Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mismatch between volumeMount name and volume name.
Incorrect mountPath causes the app to not find configs.
✗ Incorrect
The volumeMount name must match the volume name 'config-volume' and mountPath should be '/etc/config'.
5fill in blank
hardFill all three blanks to create a pod spec that mounts the ConfigMap volume, sets a subPath, and uses a specific key.
Kubernetes
spec:
containers:
- name: app
image: busybox
volumeMounts:
- name: [1]
mountPath: [2]
subPath: [3]
volumes:
- name: config-volume
configMap:
name: app-config
items:
- key: special.conf
path: special.conf Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using directory path instead of full file path in mountPath.
Not matching subPath to the key name in ConfigMap items.
✗ Incorrect
VolumeMount name is 'config-volume', mountPath is the full file path '/etc/config/special.conf', and subPath is the key file 'special.conf'.