0
0
Kubernetesdevops~20 mins

Creating ConfigMaps from files in Kubernetes - Practice Exercises

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
ConfigMap Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Output of creating ConfigMap from multiple files
What is the output of the following command when run in a directory containing app.properties and db.properties files?
Kubernetes
kubectl create configmap app-config --from-file=app.properties --from-file=db.properties
Aerror: invalid syntax
Berror: file not found
Cconfigmap/app-config unchanged
Dconfigmap/app-config created
Attempts:
2 left
💡 Hint
The command creates a ConfigMap named 'app-config' from the specified files if they exist.
Configuration
intermediate
2:00remaining
Correct syntax to create ConfigMap from directory
Which command correctly creates a ConfigMap named my-config from all files in the directory config-dir/?
Akubectl create configmap my-config --from-directory=config-dir/
Bkubectl create configmap my-config --from-file=config-dir/*
Ckubectl create configmap my-config --from-dir=config-dir/
Dkubectl create configmap my-config --from-file=config-dir/
Attempts:
2 left
💡 Hint
Use the correct flag to include all files in a directory.
Troubleshoot
advanced
2:00remaining
Error when creating ConfigMap from non-existent file
What error will occur when running this command if missing.conf does not exist?
Kubernetes
kubectl create configmap missing-config --from-file=missing.conf
Aerror: the path "missing.conf" does not exist
Bconfigmap/missing-config created with empty data
Cerror: invalid ConfigMap name
Dconfigmap/missing-config created with default data
Attempts:
2 left
💡 Hint
Check if the file path exists before creating a ConfigMap from it.
🔀 Workflow
advanced
2:00remaining
Steps to update ConfigMap from updated files
You have updated files in config-updates/. Which sequence of commands correctly updates the existing ConfigMap app-config with these files?
A1,2
B2,1
C4,3
D4,1,2
Attempts:
2 left
💡 Hint
Use dry-run to generate YAML and then apply it to update without deleting.
Best Practice
expert
3:00remaining
Best practice for managing ConfigMaps from multiple files in CI/CD
In a CI/CD pipeline, what is the best practice to manage ConfigMaps created from multiple configuration files to ensure consistency and traceability?
AManually edit ConfigMaps in the cluster after deployment to fix any issues
BGenerate ConfigMap YAML manifests from files using dry-run and store them in version control, then apply in pipeline
CCreate ConfigMaps directly in the cluster using kubectl create commands in the pipeline without storing manifests
DUse kubectl patch to update ConfigMaps with inline JSON patches in the pipeline
Attempts:
2 left
💡 Hint
Think about how to keep track of changes and have reproducible deployments.