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 →
- List Deployments; find ones referencing the secret in
env[].valueFrom.secretKeyRef,envFrom[].secretReforvolumes[].secret. - Patch each with the
kubectl.kubernetes.io/restartedAtannotation on the pod template, triggering a rolling restart. - Watch rollout status (
status.updatedReplicas == spec.replicasandavailableReplicas) before moving to the next. - 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.
More on Kubernetes, Docker, SSH & fleet automation
You need a report of every pod in the cluster with no CPU or memory limits. How do you write it?BeginnerYou are asked to write a small operator-like script that adds a label to every new namespace. How do you approach it?AdvancedYour CI runners keep running out of disk because of Docker images. Write a cleanup plan in Python.IntermediateYou need to run `df -h` on 300 Linux hosts and list any above 85%. Python or Ansible?BeginnerA Python script SSHes to hosts with `AutoAddPolicy`. Security says that is unacceptable. What do you change?IntermediateYou want to validate all Kubernetes manifests in a repo in CI with Python. What would the script check?Intermediate