Challenge - 5 Problems
ConfigMap Volume Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
Output of Pod with ConfigMap volume mount
Given the following Pod YAML snippet mounting a ConfigMap as a volume, what will be the content of the file
/etc/config/app.properties inside the container?Kubernetes
apiVersion: v1
kind: Pod
metadata:
name: configmap-volume-pod
spec:
containers:
- name: test-container
image: busybox
command: ["cat", "/etc/config/app.properties"]
volumeMounts:
- name: config-volume
mountPath: /etc/config
volumes:
- name: config-volume
configMap:
name: app-config
---
apiVersion: v1
kind: ConfigMap
metadata:
name: app-config
data:
app.properties: |
key1=value1
key2=value2Attempts:
2 left
💡 Hint
Remember that mounting a ConfigMap as a volume creates files named after the keys with their content as the file content.
✗ Incorrect
When a ConfigMap is mounted as a volume, each key becomes a file with the key's content as the file content. Here, the key is 'app.properties' with the content 'key1=value1\nkey2=value2'. So the file '/etc/config/app.properties' contains those lines.
🧠 Conceptual
intermediate1:30remaining
Behavior of ConfigMap volume updates in running Pods
If a ConfigMap used as a mounted volume in a running Pod is updated, what happens to the files inside the Pod's volume?
Attempts:
2 left
💡 Hint
Think about how Kubernetes syncs ConfigMap volumes with the cluster state.
✗ Incorrect
Kubernetes automatically updates the files in the mounted ConfigMap volume within a few seconds after the ConfigMap changes, without needing to restart the Pod. This is because the volume uses a special mechanism to watch for changes.
❓ Configuration
advanced2:30remaining
Correct YAML for mounting multiple ConfigMap keys as files
Which YAML snippet correctly mounts only the keys
config1 and config2 from a ConfigMap named multi-config as files inside /etc/config in a Pod?Attempts:
2 left
💡 Hint
Look for the correct use of the 'items' field with 'key' and 'path' under configMap.
✗ Incorrect
The 'items' field under configMap allows specifying which keys to mount and their file names. Each item must have a 'key' and a 'path'. Options A, B, and D use incorrect fields or missing keys causing errors or ignoring keys.
❓ Troubleshoot
advanced2:00remaining
Troubleshooting missing ConfigMap files in Pod
A Pod mounts a ConfigMap as a volume, but inside the container the expected files are missing. Which is the most likely cause?
Attempts:
2 left
💡 Hint
Check if the ConfigMap name matches exactly and exists in the same namespace.
✗ Incorrect
If the ConfigMap does not exist or the name is wrong, Kubernetes cannot mount it, so the files won't appear. Container image or permissions do not affect mounting ConfigMap volumes. VolumeMount paths must be absolute, but if not, Kubernetes throws an error preventing Pod creation.
🔀 Workflow
expert3:00remaining
Steps to update ConfigMap data and apply changes to running Pods
What is the correct sequence of commands to update a ConfigMap named
app-config with new data from a file new-config.properties and ensure running Pods using it get the updated content?Attempts:
2 left
💡 Hint
First generate updated ConfigMap YAML, then apply it, then restart Pods to pick changes.
✗ Incorrect
You first create an updated ConfigMap manifest with the new file (step 1), then apply it to update the ConfigMap in the cluster (step 2). Since mounted ConfigMap volumes update automatically, restarting Pods is optional but recommended to reload app config (step 3). Finally, check Pod status (step 4).