How do you force-fix common stuck states: namespace stuck Terminating, PV Released, stuck finalizers?
AdvancedProductionRapid-Fire Commands
Answer
kubectl get ns stuck -o json | jq '.spec.finalizers=[]' | kubectl replace --raw /api/v1/namespaces/stuck/finalize -f -
kubectl patch pv pv-1 --type=json -p='[{"op":"remove","path":"/spec/claimRef"}]'
kubectl patch crd foos.example.com --type=merge -p '{"metadata":{"finalizers":[]}}'
Only after confirming the controller is gone; these skip cleanup and can orphan cloud resources.
More on Rapid-Fire Commands
How do you list all Pods across namespaces with node and IP?BeginnerHow do you find why a Pod is Pending or not starting?BeginnerHow do you scale a Deployment or StatefulSet imperatively?BeginnerHow do you get a shell into a running container and run a one-off Pod?BeginnerHow do you see all resources and their short names?BeginnerHow do you generate YAML for a resource without creating it?Beginner