0
0
Kubernetesdevops~10 mins

Using ConfigMaps as environment variables 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 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'
AAPP_MODE=production
BAPP_MODE production
CAPP_MODE: production
DAPP_MODE=>production
Attempts:
3 left
💡 Hint
Common Mistakes
Using spaces instead of '=' between key and value.
Using ':' or '=>' which are invalid here.
2fill in blank
medium

Complete 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'
Aapp-config
Bappconfig
Cconfig-app
Dapp_config
Attempts:
3 left
💡 Hint
Common Mistakes
Using underscores instead of hyphens.
Changing the order of words in the name.
3fill in blank
hard

Fix 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'
AappMode
Bapp_mode
CAppMode
DAPP_MODE
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase or camelCase instead of uppercase with underscores.
Misspelling the key name.
4fill in blank
hard

Fill 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'
AAPP_MODE
Bapp-config
Capp_mode
Dconfigmap
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect env var names that don't match the key.
Using wrong ConfigMap names.
5fill in blank
hard

Fill 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'
AconfigMapRef
Bapp-config
Cfalse
DsecretRef
Attempts:
3 left
💡 Hint
Common Mistakes
Using secretRef instead of configMapRef.
Setting optional to true when the ConfigMap is required.