in kubernetes, how to update pods to use updated configmap

7/12/2018

I'm running more than one replicas of pods with kubernetes deployment and I'd like to update the replicas to use updated configmap in a rolling way. same like rolling-update works.

So that kubernetes will terminate pod and start sending traffic to the newly updated pods one at a time until all pods will be updated.

Can I use rolling-update with deployment?

-- Maoz Zadok
docker
google-cloud-platform
google-kubernetes-engine
kubernetes

2 Answers

7/12/2018

Applying a change to the Deployment object will trigger a rolling-update. From the docs:

A Deployment’s rollout is triggered if and only if the Deployment’s pod template (that is, .spec.template) is changed, for example if the labels or container images of the template are updated. Other updates, such as scaling the Deployment, do not trigger a rollout.

So if you want to trigger a rolling update to update your configmap I would suggest you update a metadata label. Perhaps a CONFIG_VER key.

-- Zach
Source: StackOverflow

8/9/2018

To automatically perform a rolling update of deployment on configmap update, you can also use a tool that my team has built and opensourced: Reloader which we are also using in production clusters of our customers.

Reloader watches changes in ConfigMap and Secret and updates the associated Deployments, Deamonsets and Statefulsets, based on the configured update strategy.

-- Ahmad
Source: StackOverflow