Orphans, adoption and a stuck namespace

  • 12 min
  • 6 steps
  • The API and the loop

Steps

0 of 6 done

Trace who owns the pods of a Deployment, replace the Deployment without restarting a single pod, then find and release the finalizer that holds a namespace in Terminating.

  1. Step 1 of 6

    The orders namespace runs a Deployment called api. Find out which object controls each api pod, by kind and name.

    Checked against what your commands print.

  2. Step 2, not started: The api Deployment must be recreated from api.yaml, but the pods serve live traffic. Delete the Deployment so that its ReplicaSet and pods keep running.

  3. Step 3, not started: Recreate the Deployment from api.yaml. Check the pod names and ages afterwards: the Deployment should adopt the ReplicaSet you left behind rather than replace the pods.

  4. Step 4, not started: The scratch namespace held a one-off export job and is no longer needed. Delete it without waiting for the deletion to finish.

  5. Step 5, not started: Minutes later scratch is still Terminating. Find the object that remains inside it and the finalizer that holds it.

  6. Step 6, not started: The controller that owned example.com/upload-report was uninstalled long ago, and the export it guarded is not needed. Remove that finalizer, and only that one, so the namespace can finish deleting.

Lab terminal

Cluster time 1 minute
kind cluster kx, Kubernetes 1.37.
Each step is checked as you work.
​
Tab completes. Up and Down recall.
Type help for more.
Terminal keys

Enter runs the command. Tab completes, and the arrow keys recall earlier commands. Control C stops a watch. On an empty line, or after Escape, Tab moves focus out of the terminal.