What should I do if I have been in Terminating state after deleting ns?
Today, I'll tell you what to do when you delete ns and stay in the Terminating state. The content of the article is good. Now I would like to share it with you. Friends who feel in need can understand it. I hope it will be helpful to you. Let's read it along with the editor's ideas.
Problem 1: delete ns and always be in Terminating state
Forced deletion is also an error report.
Warning: Immediate deletion does not wait for confirmation that the running resource has been terminated. The resource may continue to run on the cluster indefinitely.Error from server (Conflict): Operation cannot be fulfilled on namespaces "devtesting": The system is ensuring all content is removed from this namespace. Upon completion, this namespace will automatically be purged by the system.
Solution:
Kubectl get namespace devtesting-o json > devtesting.json
# cat devtesting.json {"apiVersion": "v1", "kind": "Namespace", "metadata": {"annotations": {"cattle.io/status": "{\" Conditions\ ": [{\" Type\ ":\" ResourceQuotaInit\ ",\" Status\ ":\" True\ ",\" Message\ ":\" LastUpdateTime\ ":\" 2019-09-23T07:24:02Z\ "} {\ "Type\":\ "InitialRolesPopulated\",\ "Status\":\ "True\",\ "Message\":\ "LastUpdateTime\":\ "2019-09-23T07:24:02Z\"} "," lifecycle.cattle.io/create.namespace-auth ":" true "}," creationTimestamp ":" 2019-09-23T07:23:03Z "," deletionTimestamp ":" 2019-09-30T06:35:09Z " "labels": {"name": "devtesting"}, "name": "devtesting", "resourceVersion": "6153812", "selfLink": "/ api/v1/namespaces/devtesting", "uid": "a00e013b-0066-4b64-915d-05acde5c9a09"} "spec": {"finalizers": ["kubernetes"]}, "status": {"phase": "Terminating"}}
Delete the spec field because the k8s cluster carries authentication
Execute the following curl command to delete using port 8080 of kube-apiserver
Curl-k-H "Content-Type: application/json"-X PUT-- data-binary @ devtesting.json http://127.0.0.1:8080/api/v1/namespaces/devtesting/finalize
Note:
If kube-apiserver does not have a non-secure port open, you can manually create a proxy session
# kubectl proxy-- port=8081# curl-k-H "Content-Type: application/json"-- X PUT-- data-binary @ devtesting.json http://127.0.0.1:8081/api/v1/namespaces/test/finalize above is all the content that should be done after deleting ns and has been in the Terminating state. For more content related to what to do after deleting ns, you can search the previous articles or browse the following articles to learn! I believe the editor will add more knowledge to you. I hope you can support it!