当前位置:网站首页>kubernetes_ How to solve the problem that namespace cannot be deleted
kubernetes_ How to solve the problem that namespace cannot be deleted
2022-04-22 21:02:00 【One third of the meal is full】
scene :Kubectl delete ns XXXX , namespace Always in Terminating state .

Use kubectl delete ns test --force=true, It can't be deleted .

Cause analysis : k8s Think of the current Namespace Inside , There are still unreleased resources
Actual observation ,delete After the execution of the command , Been waiting , Therefore, some resources have not been released
Solutions :
1. View all resources under the namespace
kubectl api-resources -o name --verbs=list --namespaced | xargs -n 1 kubectl get --show-kind --ignore-not-found -n test
test All resources under the namespace are No Resources
Be careful : If the resource under the namespace is not empty , Do something , Resources may continue to run on the cluster indefinitely .
2. take test Name space with json Export as a file
kubectl get namespace test -o json > test.json
3. take spec Delete the content under : The purpose of this step is to empty the content , With empty content ns Cover the original ns, inform k8s-api To delete ns Content is empty , The delete command cannot be blocked

4. Add empty content ns Of namespace , adopt api-server Interface , cover k8s In the cluster
curl -k \
-H "Content-Type: application/json" \
-X PUT \
--data-binary @test.json \
http://127.0.0.1:8001/api/v1/namespaces/test/finalize
# because k8s The master node uses authentication , If you directly use the following command, the connection will be rejected

# Need to use kube-proxy Acting as agent
kubectl proxy --port=8081
Be careful : Use kubectl proxy The command does not use daemon mode , Once you Ctrl+c after , The agent is gone
The correct approach open 2 individual k8s Master node terminal , Execute... In a window kubectl proxy, Another window connects api-server


Thank you very much CSDN Blogger 「Jerry_Pan1990」 The original article of
Link to the original text :https://blog.csdn.net/Jerry_Pan1990/article/details/103633627
版权声明
本文为[One third of the meal is full]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204222057591716.html
边栏推荐
- nodejs笔记5
- 2023 Huazhong University of science and technology automation postgraduate entrance examination ashore experience guidance of predecessors
- Leetcode Hot 100
- MySQL advanced trigger -- trigger introduction, trigger syntax and trigger case
- 智慧农业成为发展道路,充分发挥智能化,解放人力
- 打造新一代计算平台,STEPVR将在2022开启元宇宙“大门”
- 88 r user portrait linear regression logical regression comprehensive practice 1
- Ordinary functions as friends (using examples to solve friend functions)
- TC fabric manager - packaging and unpacking
- cuda10.2安装torch1.9
猜你喜欢

MySQL 进阶 触发器 -- 触发器介绍、触发器语法、触发器案例

Who is important about products and services? Changan Ford tells you "all"

Lizard book learning Day1 - overview of machine learning

2、 Linear regression

容联云携手中国信通院,开启办公即时通信软件系列标准研制

基于SEIR模型的传染病预测软件开发

MySQL advanced stored procedure storage function -- Introduction to stored procedure, basic syntax of stored procedure, variables (system variables, user-defined variables, local variables), if, param

MySQL advanced trigger -- trigger introduction, trigger syntax and trigger case

UnityShader入门精要——素描效果渲染

【MySQL从入门到精通】:关于常用like子句中通配符的总结
随机推荐
二、线性回归
The traffic not included in the Internet era is all included in the industrial Internet era
Consul 的使用
2022 R2 mobile pressure vessel filling training test questions and online simulation test
UnityShader入门精要——素描效果渲染
2022年R2移动式压力容器充装培训试题及在线模拟考试
TC 结构管理器 - 打包 解包
Leetcode-92-reverse linked list
[noip2012] borrow classroom
nodejs笔记2
MySQL 进阶 存储过程 存储函数 -- 存储过程介绍、存储过程基本语法、变量(系统变量、用户定义变量、局部变量)、if、参数、case、while、repeat、loop、游标、条件处理程序
Short link design and thinking
L1-046 divide singles
Win10安装Neo4j
Lenovo computer housekeeper graphic introduction: how to download Lenovo computer housekeeper?
对Swin-T中SW-MSA的一些理解
JMeter video teaching course
Nodejs notes 3
Ordinary functions as friends (using examples to solve friend functions)
Ali Interviewer: you'd better not write glide on your resume. It's not as simple as asking for the source code