Skip to content

Instantly share code, notes, and snippets.

@microwaves
Created June 14, 2019 11:06
Show Gist options
  • Save microwaves/5c33080ffb7ce970eb37d7bfbe265903 to your computer and use it in GitHub Desktop.
Save microwaves/5c33080ffb7ce970eb37d7bfbe265903 to your computer and use it in GitHub Desktop.
remove a namespace stuck on terminating
# In the Master's shell execute:
curl -k -H "Content-Type: application/json" -XPUT --cacert /srv/kubernetes/ca.crt -H "Authorization: Bearer <token>" --data-binary @ns.json https://localhost/api/v1/namespaces/namespace-name/finalize
# The bearer token can be found in the file below, under 'admin':
sudo cat /srv/kubernetes/known_tokens.csv
# Content for ns.json:
{
"kind": "Namespace",
"apiVersion": "v1",
"metadata": {
"name": "namespace-name",
"selfLink": "/api/v1/namespaces/namespace-name",
"annotations": {
"kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"v1\",\"kind\":\"Namespace\",\"metadata\":{\"annotations\":{},\"name\":\"namespace-name\"},\"spec\":{\"finalizers\":[\"foregroundDeletion\"]}}\n"
}
},
"spec": {
"finalizers": [
]
},
"status": {
"phase": "Terminating"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment