Restarting workloads

Kubernetes does not restart a pod when a Secret changes. How to ask it to.

Kubernetes does not restart a pod when a Secret changes. A container reads its environment once, at start, and keeps what it read.

Without the step on this page the connector does its job and your application never notices: the Secret is current, the running process is not, and everything looks fine.

Ask for it, per workload

kubectl annotate deployment/YOUR_DEPLOYMENT \
  secrets.orcakey.sh/reload=true

There is nothing to turn on in the chart. The annotation goes on the Deployment, not on the OrcaKeySecret. Only the team that owns a workload knows whether it re-reads its configuration; the team that owns the projection does not.

What happens

When the Secret changes, the operator updates an annotation on the Deployment’s pod template. Changing a pod template is what a rolling update is, so Kubernetes replaces the pods as it would for any other change — gradually, respecting your readiness probes.

It does not roll for nothing

A resync that changes nothing restarts nothing. Neither does restarting or upgrading the operator: the annotation’s value is derived from the Secret itself, so a fresh operator computes the same value and writes the same bytes, which Kubernetes treats as no change.

If a workload cannot tolerate a restart

Do not annotate it. The Secret stays current either way, and you restart that workload when it suits you.