0
0
Kubernetesdevops~10 mins

Using ConfigMaps as mounted volumes 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 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'
Amy-config
Bconfig-map
Capp-config
Dappdata
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different name than 'app-config' causes the mount to fail.
Misspelling the name in metadata.
2fill in blank
medium

Complete 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'
AconfigMap
Bsecret
CpersistentVolumeClaim
DemptyDir
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'secret' instead of 'configMap' causes errors.
Using 'emptyDir' mounts an empty directory, not the ConfigMap.
3fill in blank
hard

Fix 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'
A/etc/config
B/config
C/etc/configs
D/var/config
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.
4fill in blank
hard

Fill 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'
Aconfig-volume
B/etc/config
C/config
Dapp-config
Attempts:
3 left
💡 Hint
Common Mistakes
Mismatch between volumeMount name and volume name.
Incorrect mountPath causes the app to not find configs.
5fill in blank
hard

Fill 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'
Aconfig-volume
B/etc/config/special.conf
Cspecial.conf
D/etc/config
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.