k8s的namespace一直Terminating的完美解决方案
在k8s集群中进行测试删除namespace是经常的事件,而为了方便操作,一般都是直接对整个名称空间进行删除操作。
相信道友们在进行此步操作的时候,会遇到要删除的namespace一直处于Terminating。下面我将给出一个完美的解决方案,
测试demo
创建demo namespace# kubectl create ns testnamespace/test created删除demo namespace# kubectl delete ns testnamespace "test" deleted一直处于deleted不见exit查看状态 可见test namespace 处于Terminating # kubectl get ns -wNAME STATUS AGEtest Terminating 18s下面给出一种完美的解决方案:调用接口删除
开启一个代理终端# kubectl proxyStarting to serve on 127.0.0.1:8001再开启一个操作终端将test namespace的配置文件输出保存# kubectl get ns test -o json > test.json删除spec及status部分的内容还有metadata字段后的","号,切记!剩下内容大致如下{ "apiVersion": "v1", "kind": "Namespace", "metadata": { "annotations": { "cattle.io/status": "{\"Conditions\":[{\"Type\":\"ResourceQuotaInit\",\"Status\":\"True\",\"Message\":\"\",\"LastUpdateTime\":\"2020-10-09T07:12:17Z\"},{\"Type\":\"InitialRolesPopulated\",\"Status\":\"True\",\"Message\":\"\",\"LastUpdateTime\":\"2020-10-09T07:12:18Z\"}]}", "lifecycle.cattle.io/create.namespace-auth": "true" }, "creationTimestamp": "2020-10-09T07:12:16Z", "deletionTimestamp": "2020-10-09T07:12:22Z", "name": "test", "resourceVersion": "471648079", "selfLink": "/api/v1/namespaces/test", "uid": "862d311e-d87a-48c2-bc48-332a4db9dbdb" }}调接口删除# curl -k -H "Content-Type: application/json" -X PUT --data-binary @test.json "kind": "Namespace", "apiVersion": "v1", "metadata": { "name": "test", "selfLink": "/api/v1/namespaces/test/finalize", "uid": "862d311e-d87a-48c2-bc48-332a4db9dbdb", "resourceVersion": "471648079", "creationTimestamp": "2020-10-09T07:12:16Z", "deletionTimestamp": "2020-10-09T07:12:22Z", "annotations": { "cattle.io/status": "{\"Conditions\":[{\"Type\":\"ResourceQuotaInit\",\"Status\":\"True\",\"Message\":\"\",\"LastUpdateTime\":\"2020-10-09T07:12:17Z\"},{\"Type\":\"InitialRolesPopulated\",\"Status\":\"True\",\"Message\":\"\",\"LastUpdateTime\":\"2020-10-09T07:12:18Z\"}]}", "lifecycle.cattle.io/create.namespace-auth": "true" } }, "spec": { }, "status": { "phase": "Terminating", "conditions": [ { "type": "NamespaceDeletionDiscoveryFailure", "status": "True", "lastTransitionTime": "2020-10-09T07:12:27Z", "reason": "DiscoveryFailed", "message": "Discovery failed for some groups, 1 failing: unable to retrieve the complete list of server APIs: metrics.k8s.io/v1beta1: the server is currently unable to handle the request" }, { "type": "NamespaceDeletionGroupVersionParsingFailure", "status": "False", "lastTransitionTime": "2020-10-09T07:12:28Z", "reason": "ParsedGroupVersions", "message": "All legacy kube types successfully parsed" }, { "type": "NamespaceDeletionContentFailure", "status": "False", "lastTransitionTime": "2020-10-09T07:12:28Z", "reason": "ContentDeleted", "message": "All content successfully deleted" } ] }}查看结果
1、delete 状态终止kubectl delete ns testnamespace "test" deleted2、Terminating状态终止kubectl get ns -wtest Terminating 18stest Terminating 17m名称空间被删除掉
原文转载:http://www.shaoqun.com/a/480856.html
vava:https://www.ikjzd.com/w/2780
reverb:https://www.ikjzd.com/w/1273
indiegogo:https://www.ikjzd.com/w/265
k8s的namespace一直Terminating的完美解决方案在k8s集群中进行测试删除namespace是经常的事件,而为了方便操作,一般都是直接对整个名称空间进行删除操作。相信道友们在进行此步操作的时候,会遇到要删除的namespace一直处于Terminating。下面我将给出一个完美的解决方案,测试demo创建demonamespace#kubectlcreatenstestnames
hemingway:https://www.ikjzd.com/w/2344
手机trademanager:https://www.ikjzd.com/w/730
重磅!暴击还在继续,亚马逊FBA宣布暂停移除操作!:https://www.ikjzd.com/home/118855
ShareSave:https://www.ikjzd.com/w/929
做独立站,如何最快速的获取谷歌排名从而获得免费流量?:https://www.ikjzd.com/home/18220
没有评论:
发表评论