在部署kuboard控制平台的时候,不规范删除,导致ns状态为Terminating

[root@master01 ~]# kubectl delete namespace kuboard 

^C
root@master01 ~]# kubectl get ns
NAME STATUS AGE
default Active 25h
kube-flannel Active 24h
kube-node-lease Active 25h
kube-public Active 25h
kube-system Active 25h
kuboard Terminating 21h
[root@master01 ~]#

尝试1,还是不行

使用 -grace-period=0 --force 参数强行删除,还是不行

[root@master01 ~]# kubectl delete namespace kuboard  --grace-period=0 --force
warning: Immediate deletion does not wait for confirmation that the running resource has been terminated. The resource may continue to run on the cluster indefinitely.
namespace "kuboard" force deleted ^C
[root@master01 ~]#
[root@master01 ~]# kubectl get ns
NAME STATUS AGE
default Active 39h
kube-flannel Active 39h
kube-node-lease Active 39h
kube-public Active 39h
kube-system Active 39h
kuboard Terminating 36h

尝试2,调用kubernetes-API删除

感谢大哥的文章: http://www.manongjc.com/detail/40-xxgstfjidoveeot.html

1、首先,获取要删除 NameSpace 的 JSON 文件:

替换其中的 <terminating-namespace> 为实际 namespace
kubectl get namespace <terminating-namespace> -o json >tmp.json [root@master01 ~]# kubectl get namespace kuboard -o json > tmp.json

2、编辑上一步导出的 json 文件,去除 spec.finalizers 配置

[root@master01 ~]# vim tmp.json
····
"spec": {
"finalizers": []
····

3、打开另一个ssh窗口运行kubectl proxy开启代理

[root@master01 ~]# kubectl proxy
Starting to serve on 127.0.0.1:8001

4、删除 namespace

其中 tmp.json 为第一步中导出的 json 文件, 需替换为实际的 namespace

$ curl -k -H "Content-Type: application/json" -X PUT --data-binary @tmp.json http://127.0.0.1:8001/api/v1/namespaces//finalize

[root@master01 ~]# kubectl  get ns
NAME STATUS AGE
default Active 39h
kube-flannel Active 39h
kube-node-lease Active 39h
kube-public Active 39h
kube-system Active 39h
kuboard Terminating 36h
[root@master01 ~]#
[root@master01 ~]# curl -k -H "Content-Type: application/json" -X PUT --data-binary @tmp.json http://127.0.0.1:8001/api/v1/namespaces/kuboard/finalize }[root@master01 ~]# kubectl get ns
NAME STATUS AGE
default Active 39h
kube-flannel Active 39h
kube-node-lease Active 39h
kube-public Active 39h
kube-system Active 39h
[root@master01 ~]#

完成对namespace状态Terminating的删除

kubernetes删除ns异常状态为:Terminating的更多相关文章

  1. 【Kubernetes】Kubernetes删除namespace后持续terminating状态

    删除isti和foo的配置文件之后,namespace持续terminating状态,此时也无法再创建istio-system的namespace namespace "istio-syst ...

  2. azure删除ns时一直处于terminating状态

    写个脚本 #!/bin/bash NAMESPACE=corekubectl proxy &kubectl get namespace $NAMESPACE -o json |jq '.spe ...

  3. kubernetes删除pod一直处于terminating状态的解决方法

    kubernetes删除pod一直处理 Terminating状态 # kubectl get po -n mon NAME READY STATUS RESTARTS AGE alertmanage ...

  4. Kubernetes删除一直处于Terminating状态的namespace

    问题现象: 删除namespace,一直处于Terminating,并且用--force --grace-period=0 也删除不了 develop Terminating 4d9h Error f ...

  5. k8s的pod或者ns资源一直terminating删除办法

    假设你要删掉的ns资源,发现一直删不了处于terminating状态 1.首先试一下先把这个ns的所有pod都删掉kubectl delete pod --all -n <terminating ...

  6. kubernetes删除pod,pod一直处于Terminating状态

    删除pod,pod一直处于Terminating状态 [root@yxz-cluster01 deploy_yaml]# kubectl get pod -n yunanbao NAME READY ...

  7. Kubernetes 删除 namespace

    一. 正常情况情况下的删除: kubectl delete namespace jenkins 二. 如果上面的方法不能删除,且namespace的状态一直显示为Terminating的话 要查看一下 ...

  8. k8s 删除ns 卡住的解决办法

    在某些情况下,在k8s中会无法删除某个namespace,它会一直卡在terminating状态下.解决这个问题的步骤为: kubectl api-resources --verbs=list --n ...

  9. ns 状态为Terminating

    kubectl delete ns harbor --force --grace-period=0harbor状态为Terminatingkubectl proxy --port=6880kubect ...

  10. k8s被删除的pod一直Terminating状态

    微服务项目,部分服务无法delete,一直处于Terminating状态 kubectl get po -n gift 强制删除product:kubectl delete -n gift po/pr ...

随机推荐

  1. css 选择器优先级?

    !important > 行内样式(比重1000)> ID 选择器(比重100) > 类选择器(比重10) > 标签(比重1) > 通配符 > 继承 > 浏览 ...

  2. SpringBoot 2.5.5整合SpringSecurity+JWT

    目录结构 添加依赖 <!-- SpringSecurity --> <dependency> <groupId>org.springframework.boot&l ...

  3. Mybatis XXXMapper.xml映射文件配置

    <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "- ...

  4. Oracle 锁表查询和解锁方法

    system登录 查询被锁表信息 select sess.sid, sess.serial#, lo.oracle_username, lo.os_user_name, ao.object_name, ...

  5. SqlParameter,参数化查询问题

    SqlParameter p = new SqlParameter("@pageIndex", (object)pageIndex); SqlParameter带有两个参数的构造函 ...

  6. 阅读翻译Mathematics for Machine Learning之2.8 Affine Subspaces

    阅读翻译Mathematics for Machine Learning之2.8 Affine Subspaces 关于: 首次发表日期:2024-07-24 Mathematics for Mach ...

  7. pytest批量执行多个测试文件(批量执行一个文件夹下的所有测试用例)

    图片 代码 #!/usr/bin/env python # @File : test_runall.py import pytest import os # path = os.path.dirnam ...

  8. 基于动态数据源的SAAS系统(SpringBoot+MybaitsPlus+Durid)

    一.什么是SAAS系统 SAAS全称 Software as a Service,软件即服务.本人接触SAAS也在近两年:在我的理解,SAAS不是特指某种系统,它是提供某类产品的系统服务平台,让第三方 ...

  9. ambari+ bigtop 编译、打包、部署步骤总览

    1 ambari + bigtop 构建大数据基础平台 1.1 参考: 1.2 参考 amabri bigtop 打包部署 2 ambari+bigtop编译.打包.部署 2.0 基础环境准备 2.1 ...

  10. Jmeter函数助手24-longSum

    longSum函数可用于计算两个或多个长值的和.intSum函数参数值的范围在-2147483648到2147483647之间,而longSum函数的参数值范围比intSum的大. First lon ...