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 问题描述: 当我们的界面需要在程序运行中不断更新数据时, 当 ...
随机推荐
- C#转PHP
官方主页 https://github.com/isukces/cs2php 快速开始 http://www.cs2php.com/how-to-begin.htm#.W2rBhC2B3mI 如何在V ...
- DHCP和NAT
DHCP(dynamic host configuration protocol)用于内网动态分配IP,是一种基于UDP的应用层协议. NAT(net address translation)用于内网 ...
- 「面向 offer 学算法」笔面试大杀器 -- 单调栈
目录 前言 单调栈 初入茅庐 小试牛刀 打怪升级 出师试炼 前言 单调栈是一种比较简单的数据结构.虽然简单,但在某些题目中能发挥很好的作用. 最近很多大厂的笔试.面试中都出现了单调栈的题目,而还有不少 ...
- basicInterpreter1.01 支持分支语句
源码:https://files.cnblogs.com/files/heyang78/basicInterpreter-20200531-1.rar 输入: count= print(count) ...
- SQL分词器1.10版
处理SQL及分词效果: select * from ( select rownum as rn,tb1.stuid,tb1.summary from ( select stuid,sum(score) ...
- ZT:如果有来生,要做一棵树
出处:https://zhidao.baidu.com/question/393644025.html 原以为是三毛所作,想不到还有争议. 如果有来生,要做一棵树, 站成永恒.没有悲欢的姿势, 一半在 ...
- 索引对单表查询的影响(Cost和consistent gets)
前提:使用system账户登录sql plus. 建表: SQL> create table t2 as select * from dba_objects; 表已创建. 已用时间: 00: 0 ...
- HKDAS产品技术架构图
- 在Oracle Sql Developer/Sql Plus中查看oracle版本
输入select * from v$version; 执行即可. 此法在Sql plus中执行效果: SQL> select * from v$version; BANNER --------- ...
- C#封装YOLOv4算法进行目标检测
C#封装YOLOv4算法进行目标检测 概述 官网:https://pjreddie.com/darknet/ Darknet:[Github] C#封装代码:[Github] YOLO: 是实现实时物 ...