问题描述
我已经删除了一个卡住"的命名空间,并以这种永恒的终止"状态显示.
I've had a "stuck" namespace that I deleted showing in this eternal "terminating" status.
推荐答案
假定您已经尝试强制删除以下资源:豆荚处于终止状态,而您竭尽全力地尝试恢复名称空间...
Assuming you've already tried to force-delete resources like:Pods stuck at terminating status, and your at your wits' end trying to recover the namespace...
您可以强制删除名称空间(也许留下悬挂的资源):
You can force-delete the namespace (perhaps leaving dangling resources):
(
NAMESPACE=your-rogue-namespace
kubectl proxy &
kubectl get namespace $NAMESPACE -o json |jq '.spec = {"finalizers":[]}' >temp.json
curl -k -H "Content-Type: application/json" -X PUT --data-binary @temp.json 127.0.0.1:8001/api/v1/namespaces/$NAMESPACE/finalize
)
-
This is a refinement of the answer here, which is based on the comment here.
我正在使用
jq
实用程序以编程方式删除终结器部分中的元素.您可以改为手动操作.I'm using the
jq
utility to programmatically delete elements in the finalizers section. You could do that manually instead.kubectl proxy
默认在127.0.0.1:8001
处创建侦听器.如果您知道群集主服务器的主机名/IP,则可以使用它.kubectl proxy
creates the listener at127.0.0.1:8001
by default. If you know the hostname/IP of your cluster master, you may be able to use that instead.有趣的是,即使使用
kubectl edit
进行相同的更改也没有效果,这种方法似乎仍然有效.The funny thing is that this approach seems to work even when using
kubectl edit
making the same change has no effect.这篇关于命名空间“卡住"作为终止,如何删除它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!