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的完美解决方案的更多相关文章

  1. k8s删除namespace一直处于terminating状态

    k8s删除namespace一直处于terminating状态 当遇到删除ns是一直处于terminating情况可以用调k8s api进行删除. 1.创建api proxy. [root@node1 ...

  2. 完美解决方案,可排除DATASET不支持System.Nullable错误

    完美解决方案,可排除DATASET不支持System.Nullable错误 using System; using System.Collections.Generic; using System.L ...

  3. Apache服务器网站访问伪静态内页出现No input file specified.的完美解决方案

    原文地址:Apache服务器网站访问伪静态内页出现No input file specified.的完美解决方案 启用REWRITE的伪静态功能的时候,首页可以访问,而访问内页的时候,就提示:&quo ...

  4. 关于Entity Framework中的Attached报错的完美解决方案终极版

    之前发表过一篇文章题为<关于Entity Framework中的Attached报错的完美解决方案>,那篇文章确实能解决单个实体在进行更新.删除时Attached的报错,注意我这里说的单个 ...

  5. No resource found that matches the given name 'Theme.AppCompat.Light 的完美解决方案

    No resource found that matches the given name 'Theme.AppCompat.Light 的完美解决方案 首先这个问题的产生是由于缺少Theme.App ...

  6. ecshop之transport和jquery冲突之完美解决方案

    众所周知:ecshop的transport.js文件和Jquery是冲突的,两个文件不能同时调用,现给出以下完美解决方案:原因分析:在transport.js文件中,大概 580行到590行之间,这个 ...

  7. Xcode6.1标准Framework静态库制作方法。工程转Framework,静态库加xib和图片。完美解决方案。

    http://www.cocoachina.com/bbs/read.php?tid-282490.html Xcode6.1标准Framework静态库制作方法.工程转Framework,静态库加x ...

  8. Safari 前端开发调试 iOS 完美解决方案

    转http://www.2cto.com/kf/201403/283404.html afari 前端开发调试 iOS 完美解决方案 2014-03-05      0个评论    来源:Safari ...

  9. C#多线程解决界面卡死问题的完美解决方案

    C#多线程解决界面卡死问题的完美解决方案 文章转自http://www.sufeinet.com/thread-3556-1-1.html 问题描述: 当我们的界面需要在程序运行中不断更新数据时, 当 ...

随机推荐

  1. googleEarth

    中国航天科技集团有限公司 http://www.spacechina.com/n25/n144/n210/index.html Celestia [官网]: https://celestia.spac ...

  2. 尝试MatCap类型shader

    听说MatCap能在低端机上做出很漂亮的pbr效果,就尝试了一下. MatCap全称MaterailCapture,里面存的是光照信息,通过法线的xy分量去采样matcap,得到在该方向法线的光照信息 ...

  3. 第四方 fast快捷支付封装

    class Fastpay { protected $conf = [ 'appkey'=>'',//appkey 'key'=>'',//秘钥 ]; protected $http_ty ...

  4. 一文搞懂WordPress建站

    文章首发于:https://zouwang.vip/ 日日夜夜的等待,WordPress建站教程终于来了.本篇文章适用于第一次建站的小白,帮助你从零搭建起一个属于自己的网站,既然是从零,那么我就会带着 ...

  5. Activiti7 流程部署

    首先先绘制一个流程图 创建bpmn文件 然后绘制好节点 然后修改节点信息 指定负责人 点击背景,修改ID和名称 保存 然后重命名成xml 使用diagram打开 导出png 然后包xml改回bpmn ...

  6. 使用dbUnit的 IDataSet 因乱序造成assert失败而采取的措施

    本例源码下载:https://files.cnblogs.com/files/xiandedanteng/dbUnitTest20200211.zip 在做IDataSet比较时,特殊情况下会有期盼的 ...

  7. weekly-contest-205

    weekly-contest-205 1 / 5507. 替换所有的问号 class Solution { public String modifyString(String s) { StringB ...

  8. [GXYCTF2019]Ping Ping Ping wp

    根据题目考虑是命令注入方面, 打开网页,使用?ip=127.0.0.1;ls查询存在文件 后尝试使用?ip=127.0.01;cat flag.php打开flag.php无果 尝试打开index.ph ...

  9. 小程序开发-iView Weapp微信小程序UI组件库入门使用

    iView Weapp UI组件库 今天来试试iView Weapp 这个微信小程序组件库,看看好不好用~~ 官网地址: http://inmap.talkingdata.com/wx/index_p ...

  10. spyder如何切换python虚拟环境?

    2020/5/29 在anaconda下创建了很多个python虚拟环境,现在我想使用 spyder 运行python程序, 并且使用其中某一个虚拟环境,方法如下: 首先要知道 Anaconda自带的 ...