⭐ Scenario #6: Auto-Update ConfigMap Without Restarting the Pod (Using Volume Mount)

This scenario demonstrates:

✔ ConfigMap mounted as a file
✔ Pod picks up changes automatically without restart
✔ Application reads updated data from the file in real time
✔ You verify live updates

This is how apps like Nginx, Prometheus, and Spring B…


This content originally appeared on DEV Community and was authored by Latchu@DevOps

This scenario demonstrates:

✔ ConfigMap mounted as a file
✔ Pod picks up changes automatically without restart
✔ Application reads updated data from the file in real time
✔ You verify live updates

This is how apps like Nginx, Prometheus, and Spring Boot use dynamic config reloads.

🟩 Step 1 — Create a ConfigMap

Create dynamic-configmap.yaml:

apiVersion: v1
kind: ConfigMap
metadata:
  name: dynamic-config
data:
  message: "Hello from ConfigMap v1"

Apply it:

kubectl apply -f dynamic-configmap.yaml

🟩 Step 2 — Create a Pod That Mounts the ConfigMap as a File

Create pod-dynamic-config.yaml:

apiVersion: v1
kind: Pod
metadata:
  name: dynamic-config-pod
spec:
  containers:
    - name: demo-container
      image: busybox
      command: ["sh", "-c", "while true; do echo \"Message: $(cat /config/message)\"; sleep 3; done"]
      volumeMounts:
        - name: config-volume
          mountPath: /config
  volumes:
    - name: config-volume
      configMap:
        name: dynamic-config

Apply it:

kubectl apply -f pod-dynamic-config.yaml

Wait for ready:

kubectl wait --for=condition=Ready pod/dynamic-config-pod --timeout=60s

1

🟩 Step 3 — View Live Output From the Pod

Open logs:

kubectl logs -f dynamic-config-pod

You will see:

Message: Hello from ConfigMap v1
Message: Hello from ConfigMap v1
...

Keep this logs window open.

2

🟩 Step 4 — Update the ConfigMap Without Restarting the Pod

Edit the ConfigMap:

kubectl edit configmap dynamic-config

Change the value:

message: "Hello from ConfigMap v2 - UPDATED LIVE"

Save & exit.

🟩 Step 5 — Watch the Pod Update Automatically (NO Restart Needed)

Your logs will automatically switch:

Message: Hello from ConfigMap v1
Message: Hello from ConfigMap v1
Message: Hello from ConfigMap v2 - UPDATED LIVE
Message: Hello from ConfigMap v2 - UPDATED LIVE

✔ No pod restart
✔ No rollout
✔ No manual intervention

3

💡 WHY does this work?

Method Auto-Update? Reason
ConfigMap → env variables ❌ No Env vars are fixed at Pod startup
ConfigMap → mounted volume ✅ Yes Kubelet updates file symlink every ~1–2 seconds

Kubernetes mounts each ConfigMap entry as a file using a symlink that is automatically refreshed.

⚠️ IMPORTANT NOTE

Although the file updates automatically:

➡ Your application must reload the file dynamically
➡ If the app loads config only at startup, you won’t see updates

🌟 Thanks for reading! If this post added value, a like ❤️, follow, or share would encourage me to keep creating more content.

— Latchu | Senior DevOps & Cloud Engineer

☁️ AWS | GCP | ☸️ Kubernetes | 🔐 Security | ⚡ Automation
📌 Sharing hands-on guides, best practices & real-world cloud solutions


This content originally appeared on DEV Community and was authored by Latchu@DevOps


Print Share Comment Cite Upload Translate Updates
APA

Latchu@DevOps | Sciencx (2025-11-09T07:18:57+00:00) ⭐ Scenario #6: Auto-Update ConfigMap Without Restarting the Pod (Using Volume Mount). Retrieved from https://www.scien.cx/2025/11/09/%e2%ad%90-scenario-6-auto-update-configmap-without-restarting-the-pod-using-volume-mount-2/

MLA
" » ⭐ Scenario #6: Auto-Update ConfigMap Without Restarting the Pod (Using Volume Mount)." Latchu@DevOps | Sciencx - Sunday November 9, 2025, https://www.scien.cx/2025/11/09/%e2%ad%90-scenario-6-auto-update-configmap-without-restarting-the-pod-using-volume-mount-2/
HARVARD
Latchu@DevOps | Sciencx Sunday November 9, 2025 » ⭐ Scenario #6: Auto-Update ConfigMap Without Restarting the Pod (Using Volume Mount)., viewed ,<https://www.scien.cx/2025/11/09/%e2%ad%90-scenario-6-auto-update-configmap-without-restarting-the-pod-using-volume-mount-2/>
VANCOUVER
Latchu@DevOps | Sciencx - » ⭐ Scenario #6: Auto-Update ConfigMap Without Restarting the Pod (Using Volume Mount). [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/11/09/%e2%ad%90-scenario-6-auto-update-configmap-without-restarting-the-pod-using-volume-mount-2/
CHICAGO
" » ⭐ Scenario #6: Auto-Update ConfigMap Without Restarting the Pod (Using Volume Mount)." Latchu@DevOps | Sciencx - Accessed . https://www.scien.cx/2025/11/09/%e2%ad%90-scenario-6-auto-update-configmap-without-restarting-the-pod-using-volume-mount-2/
IEEE
" » ⭐ Scenario #6: Auto-Update ConfigMap Without Restarting the Pod (Using Volume Mount)." Latchu@DevOps | Sciencx [Online]. Available: https://www.scien.cx/2025/11/09/%e2%ad%90-scenario-6-auto-update-configmap-without-restarting-the-pod-using-volume-mount-2/. [Accessed: ]
rf:citation
» ⭐ Scenario #6: Auto-Update ConfigMap Without Restarting the Pod (Using Volume Mount) | Latchu@DevOps | Sciencx | https://www.scien.cx/2025/11/09/%e2%ad%90-scenario-6-auto-update-configmap-without-restarting-the-pod-using-volume-mount-2/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.