手工安装好longhorn后发现该服务有问题,想重新安装时发现执行原来delete命令后,虽然Pod内容已删除,但命名空间的删除状态一直处于terminating状态。
> kubectl get namespaces
NAME STATUS AGE
kube-node-lease Active 4d12h
default Active 4d12h
kube-system Active 4d12h
cattle-system Active 2d8h
kube-public Active 4d12h
ingress-nginx Active 32h
longhorn-system Terminating 59m
# 执行删除后还是一直处于等待状态
> kubectl delete namespaces longhorn-system
# 使用强制删除也是相同的问题
>kubectl delete namespaces longhorn-system --force --grace-period=0
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 "longhorn-system" force deleted
# 网上找到该命令,查到命名空间下确实还有一些引用pod还在运行
> kubectl api-resources -o name --verbs=list --namespaced | xargs -n 1 kubectl get --show-kind --ignore-not-found -n longhorn-system
AME AGE
engineimage.longhorn.io/ei-e10d6bf5 55m
NAME AGE
instancemanager.longhorn.io/instance-manager-e-e1b569ed 55m
instancemanager.longhorn.io/instance-manager-r-73f4a425 55m
但是只能看到无法删除,解铃还要系铃人在官方给的github中发现有一个uninstall目录。
https://github.com/longhorn/longhorn/tree/master/uninstall
下载该文件,执行kubectl apply -f uninstall.yaml之后,longhorn-system命名空间彻底被删除。可以重新开始了。
# 重新娇艳
>kubectl delete namespaces longhorn-system --force --grace-period=0
来源:oschina
链接:https://my.oschina.net/u/1019754/blog/3208490