We often come acorss following questions while working with ConfigMap and secret are as follows;
- How to Updating Kubernetes Deployments on a ConfigMap Change?
- How Mounted ConfigMap is updated automatically in pods?
- While changing in configmap it doesn’t reflect automatically, every time I have to restart the pod. How can I do it automatically?
Answer:
To update a configmap or secret resource which depends on a deployment(pod). Obviously, updating them is not a big deal. But how would you notify to relevant deployment/pod?
Method 1: Manual restart a pod/deploy which would update volume with latest configmaps and secrets.
kubectl v1.15 now provides a rollout restart sub-command that allows you to restart Pods in a Deployment – taking into account your surge/unavailability config – and thus have them pick up changes to a referenced ConfigMap, Secret or similar. It’s worth noting that you can use this with clusters older than v1.15, as it’s implemented in the client.
Example usage: kubectl rollout restart deploy/admission-control to restart a specific deployment. Easy as that!
$ kubectl rollout restart deploy nginx -n dev
Method 2: Automatic how would you notify to relevant deployment/pod on configmaps and secrets changes?
There are very good reference for this scnario are given below;
- https://medium.com/@harik8/kubectl-restart-po-deploy-a5b4c6d523fe
- https://blog.questionable.services/article/kubernetes-deployments-configmap-change/
I’m Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms.
I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.
Find Trusted Cardiac Hospitals
Compare heart hospitals by city and services — all in one place.
Explore Hospitals