Kubernetes
HELM
redeploy
DevOps
tutorial

How to force a redeploy with Helm

Codemia Knowledge Hub ·

Some changes to a Helm release do not restart its Pods on their own, so the running application never picks them up. In that case you have to force a redeploy, and the simplest way when you own the chart is to bump the version in Chart.yaml.

Why Helm does not always roll out a change

Helm packages preconfigured Kubernetes resources as charts. A release is a named instance of a chart running in a cluster, tied to a specific chart version and set of configuration values.

When you change a resource Helm manages (a ConfigMap or Secret, for example), Helm pushes the change to the cluster and Kubernetes handles the rollout. Some changes, though, do not trigger a Deployment update automatically.

When a forced redeploy is needed

  • Configuration changes: ConfigMaps or Secrets were updated without any change to the Pods that use them.
  • Bug fixes: A workaround or patch is not captured in a new chart version.
  • Cache invalidation: The application has to restart its Pods to clear a cache.
  • Infrastructure changes: Node selectors or resource requests were updated but not picked up automatically.

Bumping the chart version

If you control the chart, increment the version number in Chart.yaml to trigger a redeployment. This only restarts Pods if the chart version appears in the Pod template, for example through a helm.sh/chart label.

bash
helm upgrade my-release ./mychart
  • Version control: Keep charts and configuration files in version control so you can track changes and roll back.
  • Testing: Try the redeploy strategy in staging before production.
  • Monitoring: Watch the rollout so problems are caught early and you can roll back.
  • Documentation: Record why each redeploy was done, for a history of changes.

Rolling Pods when a ConfigMap or Secret changes

Add a checksum of the ConfigMap template as an annotation on the Deployment's Pod template. The annotation changes whenever the ConfigMap does, so helm upgrade rolls the Pods:

yaml
1kind: Deployment
2spec:
3  template:
4    metadata:
5      annotations:
6        checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}

Rolling Pods on every upgrade

To restart on every helm upgrade, use an annotation that changes each time:

yaml
1kind: Deployment
2spec:
3  template:
4    metadata:
5      annotations:
6        rollme: {{ randAlphaNum 5 | quote }}

Both annotations use the Deployment's normal rolling update, so there is no downtime. The old --recreate-pods flag is deprecated in Helm 3 in favor of these annotations.

Restarting without a Helm upgrade

If you only need fresh Pods and nothing in the release changed, restart the Deployment directly:

bash
kubectl rollout restart deployment/my-app -n my-namespace

Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design