今天给大家介绍一下删除ns后一直处于Terminating状态中该怎么办。文章的内容小编觉得不错,现在给大家分享一下,觉得有需要的朋友可以了解一下,希望对大家有所帮助,下面跟着小编的思路一起来阅读吧。
强制删除也是出现报错
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.
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" } }
删除其中的spec字段,因为k8s集群是携带认证的
执行以下curl命令,使用kube-apiserver的8080端口,执行删除操作
curl -k -H "Content-Type: application/json" -X PUT --data-binary @devtesting.json http://127.0.0.1:8080/api/v1/namespaces/devtesting/finalize
备注:
如果kube-apiserver未开非安全端口,可以手动创建一个代理会话,
# 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
以上就是删除ns后一直处于Terminating状态中该怎么办的全部内容了,更多与删除ns后一直处于Terminating状态中该怎么办相关的内容可以搜索亿速云之前的文章或者浏览下面的文章进行学习哈!相信小编会给大家增添更多知识,希望大家能够支持一下亿速云!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。