2

I am trying to run Kubernetes namespace setup and application deployment as part of a pipeline. Normally "apply" commands work with idempotency. Now, if I change a ConfigMap, the pods need to be restarted to pick the change. But "apply"-ing the deployment doesn't have any effect as there was no change detected in the deployment itself. "create"-"delete" combination works, but is extra work and breaks blue green deployment. Is there a golden mean?

2

When you change ConfigMap content without changing its name, Deployment does not detect changes and does not create new pods.

The issue was already fixed and merged, please check here. However, it happened relatively recently (Mar 14, 2018) and maybe your version of Kubernetes does not contain that code.

You can use the following workaround for pushing Deployment to recreate new pods with updated ConfigMap - just add or update annotation of pods. It will push Deployment to create a new version of pods:

kubectl patch deployment $DEPLOYMENT_NAME -p \
"{\"spec\":{\"template\":{\"metadata\":{\"annotations\":{\"date\":\"`date +'%s'`\"}}}}}"

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.