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?

user6317694
  • 131
  • 3

1 Answers1

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'`\"}}}}}"
Anton Kostenko
  • 652
  • 6
  • 5