0
0
Kubernetesdevops~30 mins

Updating ConfigMaps and propagation in Kubernetes - Mini Project: Build & Apply

Choose your learning style9 modes available
Updating ConfigMaps and Propagation in Kubernetes
📖 Scenario: You are managing a Kubernetes cluster for a small web application. The application uses a ConfigMap to store configuration settings like the welcome message. You need to update the ConfigMap and see how the changes propagate to the running pods.
🎯 Goal: Learn how to create a ConfigMap, update it, and verify that the changes propagate to pods using volume mounts.
📋 What You'll Learn
Create a ConfigMap with a key-value pair
Create a pod that uses the ConfigMap as a volume
Update the ConfigMap with a new value
Verify the updated value inside the pod
💡 Why This Matters
🌍 Real World
ConfigMaps are used in Kubernetes to separate configuration from container images. Updating ConfigMaps and understanding how changes propagate helps keep applications flexible and easy to manage.
💼 Career
DevOps engineers and Kubernetes administrators frequently update ConfigMaps to change application behavior without rebuilding images. Knowing how to update and verify ConfigMaps is essential for managing live applications.
Progress0 / 4 steps
1
Create a ConfigMap with initial data
Create a ConfigMap named app-config with a key welcome_message and value Hello, Kubernetes! using the kubectl create configmap command.
Kubernetes
Need a hint?

Use kubectl create configmap app-config --from-literal=welcome_message='Hello, Kubernetes!' to create the ConfigMap.

2
Create a pod that uses the ConfigMap as a volume
Create a pod named configmap-pod using the busybox image. Mount the app-config ConfigMap as a volume at /etc/config. Use the command sleep 3600 to keep the pod running.
Kubernetes
Need a hint?

Use kubectl run to create the pod and patch it to add the ConfigMap volume and mount.

3
Update the ConfigMap with a new welcome message
Update the app-config ConfigMap to change the welcome_message value to Welcome to Kubernetes! using the kubectl create configmap --from-literal --dry-run=client -o yaml | kubectl apply -f - pattern.
Kubernetes
Need a hint?

Use kubectl create configmap app-config --from-literal=welcome_message='Welcome to Kubernetes!' --dry-run=client -o yaml | kubectl apply -f - to update the ConfigMap.

4
Verify the updated ConfigMap value inside the pod
Use kubectl exec to open a shell inside the configmap-pod pod and use cat /etc/config/welcome_message to display the updated welcome message.
Kubernetes
Need a hint?

Use kubectl exec configmap-pod -- cat /etc/config/welcome_message to see the updated message inside the pod.