k8s的namespace一直Terminating的完美解决方案
k8s的namespace一直Terminating的完美解决方案
在k8s集群中进行测试删除namespace是经常的事件,而为了方便操作,一般都是直接对整个名称空间进行删除操作。
相信道友们在进行此步操作的时候,会遇到要删除的namespace一直处于Terminating。下面我将给出一个完美的解决方案,
测试demo
创建demo namespace
# kubectl create ns test
namespace/test created
删除demo namespace
# kubectl delete ns test
namespace "test" deleted
一直处于deleted不见exit
查看状态 可见test namespace 处于Terminating
# kubectl get ns -w
NAME STATUS AGE
test Terminating 18s
下面给出一种完美的解决方案:调用接口删除
开启一个代理终端
# kubectl proxy
Starting 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 http://127.0.0.1:8001/api/v1/namespaces/test/finalize
{
"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 test
namespace "test" deleted
2、Terminating状态终止
kubectl get ns -w
test Terminating 18s
test Terminating 17m
名称空间被删除掉
k8s的namespace一直Terminating的完美解决方案的更多相关文章
- k8s删除namespace一直处于terminating状态
k8s删除namespace一直处于terminating状态 当遇到删除ns是一直处于terminating情况可以用调k8s api进行删除. 1.创建api proxy. [root@node1 ...
- 完美解决方案,可排除DATASET不支持System.Nullable错误
完美解决方案,可排除DATASET不支持System.Nullable错误 using System; using System.Collections.Generic; using System.L ...
- Apache服务器网站访问伪静态内页出现No input file specified.的完美解决方案
原文地址:Apache服务器网站访问伪静态内页出现No input file specified.的完美解决方案 启用REWRITE的伪静态功能的时候,首页可以访问,而访问内页的时候,就提示:&quo ...
- 关于Entity Framework中的Attached报错的完美解决方案终极版
之前发表过一篇文章题为<关于Entity Framework中的Attached报错的完美解决方案>,那篇文章确实能解决单个实体在进行更新.删除时Attached的报错,注意我这里说的单个 ...
- No resource found that matches the given name 'Theme.AppCompat.Light 的完美解决方案
No resource found that matches the given name 'Theme.AppCompat.Light 的完美解决方案 首先这个问题的产生是由于缺少Theme.App ...
- ecshop之transport和jquery冲突之完美解决方案
众所周知:ecshop的transport.js文件和Jquery是冲突的,两个文件不能同时调用,现给出以下完美解决方案:原因分析:在transport.js文件中,大概 580行到590行之间,这个 ...
- Xcode6.1标准Framework静态库制作方法。工程转Framework,静态库加xib和图片。完美解决方案。
http://www.cocoachina.com/bbs/read.php?tid-282490.html Xcode6.1标准Framework静态库制作方法.工程转Framework,静态库加x ...
- Safari 前端开发调试 iOS 完美解决方案
转http://www.2cto.com/kf/201403/283404.html afari 前端开发调试 iOS 完美解决方案 2014-03-05 0个评论 来源:Safari ...
- C#多线程解决界面卡死问题的完美解决方案
C#多线程解决界面卡死问题的完美解决方案 文章转自http://www.sufeinet.com/thread-3556-1-1.html 问题描述: 当我们的界面需要在程序运行中不断更新数据时, 当 ...
随机推荐
- Fitness - 06.01
倒计时213天 久违的瑜伽课,却发现生疏了很多,倒地不起TAT 要加强锻炼,不要松懈啊~~~! 期待黄金周的到来!!
- <init>与<clinit>,static与final与static final
<init>和<clinit> init是对象构造器方法,初始化对象的时候执行 clinit是类构造器方法,类加载的初始化阶段执行 final常量赋值(必须是一下其中一种) 显 ...
- 聊聊redis单线程为什么能做到高性能和io多路复用到底是个什么鬼
1:io多路复用epoll io多路复用简单来说就是一个线程处理多个网络请求 我们知道epoll in 的事件触发是可读了,这个比较好理解,比如一个连接过来,或者一个数据发送过来了,那么in事件就触 ...
- Zookeeper启动流程分析
前言 之前的Zookeeper协议篇-Paxos算法与ZAB协议通过了解Paoxs算法开始,到Zab协议的两大特性:崩溃恢复和消息广播,学习了Zookeeper是如何通过Zab协议实现高可用,本篇主要 ...
- redis锁操作
模拟多线程触发 package com.ws.controller; import io.swagger.annotations.Api; import io.swagger.annotations. ...
- leetcode刷题-50Pow(x, n)
题目 实现 pow(x, n) ,即计算 x 的 n 次幂函数. 思路 最初的想法n>0计算res = res*x 计算n次,n<0,将x取倒数后同理,但结果表明计算速度太慢了. 后续应该 ...
- 提升开发幸福度-IDE配置
插件 vscode插件 Settings Sync Atom One Dark Theme Bracket Pair Colorizer Code Runner Dracular Official E ...
- IDEA中配置Tomcat中的Artifact
IDEA中配置Tomcat中的Artifact 我在配置Tomcat时,要设置deployment中的Artifact时,却总是无法显示出当前项目的war包,针对这个问题,如下图展示, 当我点击Art ...
- C#开发PACS医学影像处理系统(十五):Dicom影像交叉定位线算法
1.定位线概念:某个方位的影像在另一个方向的影像上的投影相交线,例如横断面(从头到脚的方向)在矢状面(从左手到右手)上的影像投影面交线. 举个例子:右边的是MR(核磁共振)的某一帧切片,这是从头开始扫 ...
- docker部署安装zabbix
安装docker 安装docker需要配置网络yum源,centos7自带的版本太低了 第一步:下载阿里云的docker安装包 在yum仓库的目录之下 [root@localhost yum.repo ...