capabilities.work

Publish a ConfigMap and Roll Out Its Consumers

A 4-step recipe with Kubernetes. We can help you get access.

Recipe · 4 steps

Publish a ConfigMap and Roll Out Its Consumers

with Kubernetes · Configuration & Secrets Management

Publish a ConfigMap and force the consuming deployment to restart against it.

  1. List the namespace's ConfigMaps to record the configuration in place before this publish, giving the run an auditable before state.
  2. Publish the ConfigMap holding the application's non-confidential configuration as UTF-8 key/value pairs.
  3. Read the deployment that consumes the ConfigMap and capture its resourceVersion so the restart write is concurrency-safe.
  4. Replace the deployment with a changed pod-template annotation so the controller rolls the pods and they read the published configuration.
What you'll need to have ready
  • namespace: The namespace holding the ConfigMap and its consuming deployment.
  • configMapName: Name of the ConfigMap to publish.
  • configData: Map of UTF-8 key/value pairs forming the configuration.
  • deploymentName: The deployment whose pods consume the ConfigMap.
  • appName: The app label value used by the deployment selector and pod template.
  • image: Container image to preserve on the replaced deployment.
  • replicas: Replica count to preserve on the replaced deployment.
  • configStamp: Value written to the rollout annotation to force a restart. Any value that changes per publish works, such as a config hash or timestamp.
For your developer

Arazzo workflow kubernetes:config-rollout, 4 operations: listNamespacedConfigMaps → createNamespacedConfigMap → getNamespacedDeployment → replaceNamespacedDeployment. Specs on APIs.io.