删除无法终止的namespace namespace terminating
https://www.ibm.com/docs/en/cloud-private/3.2.0?topic=console-namespace-is-stuck-in-terminating-state
A namespace is stuck in the Terminating state
Symptom
A namespace is stuck in the Terminating state
Cause
If a Kubernetes API extension is not available, the resources that are managed by the extension cannot be deleted. Failure to delete the API extension causes namespace deletion to fail.
Resolving the problem
Obtain the API descriptions that are not deleted
Complete the following steps to get a description of the APIs that are not deleted:
-
View the namespaces that are stuck in a Terminating state:
-
Find the resources that are not deleted:
-
If the previous command returns the following error message:
unable to retrieve the complete list of server APIs: <api-resource>/<version>: the server is currently unable to handle the request
, continue to run the following command with the information you received:For example, run the following command for an API service that is named
custom.metrics.k8s.io/v1beta1
: -
Get a description of the API service to continue to debug your API service. Run the following command:
-
Make sure that the issue is resolved. Run the following command to verify that your namespace can be deleted:
Manually delete a terminating namespace
If the issue is not resolved, you can manually delete your namespace that is stuck in the Terminating state.
-
View the namespaces that are stuck in the Terminating state:
-
Select a terminating namespace and view the contents of the namespace to find out the
finalizer
:Your YAML contents might resemble the following output:
apiVersion: v1 kind: Namespace metadata: creationTimestamp: 2018-11-19T18:48:30Z deletionTimestamp: 2018-11-19T18:59:36Z name: <terminating-namespace> resourceVersion: "1385077" selfLink: /api/v1/namespaces/<terminating-namespace> uid: b50c9ea4-ec2b-11e8-a0be-fa163eeb47a5 spec: finalizers: - kubernetes status: phase: Terminating
-
Create a temporary JSON file:
-
Edit your
tmp.json
file. Remove thekubernetes
value from thefinalizers
field and save the file.Your
tmp.json
file might resemble the following output:{ "apiVersion": "v1", "kind": "Namespace", "metadata": { "creationTimestamp": "2018-11-19T18:48:30Z", "deletionTimestamp": "2018-11-19T18:59:36Z", "name": "<terminating-namespace>", "resourceVersion": "1385077", "selfLink": "/api/v1/namespaces/<terminating-namespace>", "uid": "b50c9ea4-ec2b-11e8-a0be-fa163eeb47a5" }, "spec": { "finalizers": }, "status": { "phase": "Terminating" } }
-
To set a temporary proxy IP and port, run the following command. Be sure to keep your terminal window open until you delete the stuck namespace:
Your proxy IP and port might resemble the following output:
-
From a new terminal window, make an API call with your temporary proxy IP and port:
Your output might resemble the following content:
{ "kind": "Namespace", "apiVersion": "v1", "metadata": { "name": "<terminating-namespace>", "selfLink": "/api/v1/namespaces/<terminating-namespace>/finalize", "uid": "b50c9ea4-ec2b-11e8-a0be-fa163eeb47a5", "resourceVersion": "1602981", "creationTimestamp": "2018-11-19T18:48:30Z", "deletionTimestamp": "2018-11-19T18:59:36Z" }, "spec": { }, "status": { "phase": "Terminating" } }
Note: The
finalizer
parameter is removed. -
Verify that the terminating namespace is removed:
-
Continue to follow the steps for other namespaces that are stuck in the Terminating state.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· .NET10 - 预览版1新功能体验(一)