共計 1820 個字符,預計需要花費 5 分鐘才能閱讀完成。
今天給大家介紹一下刪除 ns 后一直處于 Terminating 狀態中該怎么辦。文章的內容丸趣 TV 小編覺得不錯,現在給大家分享一下,覺得有需要的朋友可以了解一下,希望對大家有所幫助,下面跟著丸趣 TV 小編的思路一起來閱讀吧。
問題一:刪除 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 狀態中該怎么辦相關的內容可以搜索丸趣 TV 之前的文章或者瀏覽下面的文章進行學習哈!相信丸趣 TV 小編會給大家增添更多知識, 希望大家能夠支持一下丸趣 TV!
正文完
發表至: 計算機運維
2023-08-04