Interview Prep/Python for DevOps/Kubernetes, Docker, SSH & fleet automation

You need to restart all Deployments in a namespace that reference a rotated Secret. How?

AdvancedScenarioKubernetes, Docker, SSH & fleet automation
Answer

Situation read → Pods do not reload env vars from Secrets automatically.

What I'd do →

  1. List Deployments; find ones referencing the secret in env[].valueFrom.secretKeyRef, envFrom[].secretRef or volumes[].secret.
  2. Patch each with the kubectl.kubernetes.io/restartedAt annotation on the pod template, triggering a rolling restart.
  3. Watch rollout status (status.updatedReplicas == spec.replicas and availableReplicas) before moving to the next.
  4. Long term: use Reloader or a checksum annotation in Helm so this is automatic.

Why → One-at-a-time rollouts avoid restarting everything simultaneously.

Interview tip → Mention that volume-mounted Secrets update in place (eventually) but env vars never do.

All Python for DevOps questions Roadmap: Python for automation

More on Kubernetes, Docker, SSH & fleet automation