Your friendly one-liner. Make sure you don't terminate the wrong thing. I put in a safety check to make sure the variable is at least not empty. Just set TERMINATING_NAMESPACE
at the beginning (I had a few to delete, hence the automation).
TERMINATING_NAMESPACE=bad-namespace-here && echo "Force Terminating: ${TERMINATING_NAMESPACE}..." && echo "${TERMINATING_NAMESPACE}" != "" && kubectl get namespace ${TERMINATING_NAMESPACE} -o json | jq 'del(.spec.finalizers)' | kubectl replace --raw "/api/v1/namespaces/${TERMINATING_NAMESPACE}/finalize" -f -
Thank you for your comment. We'll review and update the Knowledge Center article as needed.
Sometimes even after going through the steps (1-4) mentioned in the repost article, the namespace remains stuck in terminating status. However, I was able to use the one-liner command provided in the comment by Rob to delete the same namespace that was stuck in terminating status and can confirm that it works.
As far as I can tell, the one-liner command does the same thing as the steps provided in the article (which is remove the finalizers from the object) but just in one line. The only requirement would be to install jq, if you don't have it installed already (yum install jq
).
Thank you for your comment. We'll review and update the Knowledge Center article as needed.
Relevant content
- asked a year ago
- Accepted Answerasked 9 months ago
- asked 2 years ago
- Accepted Answerasked a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 months ago