龙空技术网

Kubernetes如何删除“Terminating”状态下Namespace

运维技术123 88

前言:

而今我们对“nginx delete”大致比较注意,同学们都想要知道一些“nginx delete”的相关知识。那么小编在网摘上收集了一些关于“nginx delete””的相关知识,希望大家能喜欢,小伙伴们快快来学习一下吧!

Kubernetes如何删除“Terminating”状态下Namespace

1.问题场景概述:

在执行重置服务yaml文件时,一直出现卡死状态

[root@k8s-master ingress-nginx]# kubectl replace --force -f deploy.yaml
查看状态发现ingress-nginx 已变成Terminating

Namespace有两种状态:Terminating(终止)、Active(正常)

[root@k8s-master ingress-nginx]# kubectl get nsNAME                   STATUS        AGEdefault                Active        2d3hingress-nginx          Terminating   14mkube-node-lease        Active        2d3hkube-public            Active        2d3hkube-system            Active        2d3hkubernetes-dashboard   Active        133mtest-app               Active        8h
使用强制删除命令无反应:
[root@k8s-master ingress-nginx]# kubectl delete --force ns ingress-nginxwarning: 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 "ingress-nginx" force deleted

2.故障处理步骤:

导出json文件

[root@k8s-master ~]# kubectl get ns ingress-nginx -o json > ingress.json
删除spec字段
        "name": "ingress-nginx",        "resourceVersion": "473877",        "selfLink": "/api/v1/namespaces/ingress-nginx",        "uid": "ff06d89d-ea70-4d73-a5c8-3cd5198a1580"    },    "spec": {     },    "status": {        "conditions": [            {
开启代理(新建窗口回话)
[root@k8s-master ~]# kubectl proxy --port=8081
使用curl命令删除
[root@k8s-master ~]# curl -k -H "Content-Type:application/json" -X PUT --data-binary @ingress.json  
验证结果
[root@k8s-master ~]# kubectl get nsNAME                   STATUS   AGEdefault                Active   2d4hkube-node-lease        Active   2d4hkube-public            Active   2d4hkube-system            Active   2d4hkubernetes-dashboard   Active   146mtest-app               Active   8h

到此ingress-nginx工作空间已彻底删除!

标签: #nginx delete