7

k8s学习笔记(2)-删除namespace失败处理

 3 years ago
source link: http://vearne.cc/archives/39397
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
版权声明 本站原创文章 由 萌叔 发表
转载请注明 萌叔 | http://vearne.cc

警告:本文仅用于萌叔自己总结之用,对其它人而言可能毫无营养,没有阅读价值。

删除namespace出现下面的情况

╰─$ kubectl get ns                              
NAME                   STATUS        AGE
default                Active        5d3h
ingress-nginx          Active        4d22h
istio-system           Active        4d3h
kube-node-lease        Active        5d3h
kube-public            Active        5d3h
kube-system            Active        5d3h
kubernetes-dashboard   Active        39m
ns-helloworld          Terminating   3h56m

2.解决方法

2.1 导出namespace配置

kubectl get namespace ns-helloworld -o json > tmp.json

namespace无法删除是因为namespace相关联的资源无法释放。

bf4746fc-11da-11eb-b52d-784f43a6cab8.jpeg

2.2 清空spec中的内容

4a34b308-11db-11eb-91ca-784f43a6cab8.jpeg

2.3 触发

kubectl proxy
curl -k -H "Content-Type: application/json" -X PUT --data-binary @tmp.json http://127.0.0.1:8001/api/v1/namespaces/ns-helloworld/finalize
  1. kubernetes无法删除namespace 提示 Terminating

请我喝杯咖啡

微信支付码

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK