Hammed
Hammed

Reputation: 1557

Automatically deploy when configMap changes

Does anyone know how to get a Kubernetes deployment to automatically update when a configMap is changed?

Upvotes: 3

Views: 1057

Answers (3)

rohit Aggarwal
rohit Aggarwal

Reputation: 31

As mentioned by @coderanger, by default Kubernetes doesn't provide anything like this by default.

Consider using kapp. kapp has the concept of (versioned) resources. You can mark the ConfigMap as a versioned resource. After that, anytime this configmap will be updated, all the K8s resources referring this ConfigMap will be updated as well.

Upvotes: 3

P Ekambaram
P Ekambaram

Reputation: 17621

Consider reloader, a kubernetes controller, that watches changes to configmaps and secrets and will trigger a deployment when there is any change --> https://github.com/stakater/Reloader

Upvotes: 3

coderanger
coderanger

Reputation: 54211

Unfortunately there is nothing built in for this. You used the helm tag, so with Helm you do this by setting a checksum of the rendered configmap (or secret, same issue there) as an annotation in the pod template. This means that changing the configmap results in a (meaningless) change to the pod template, which triggers a rolling update.

Upvotes: 4

Related Questions