遇到问题---kubectl delete deployments报错Error from server (NotFound): the server could not find the reque
情况
使用kubectl命令可以查看到deployments
zhangxiaofans-MacBook-Pro:Downloads joe$ kubectl get deployments
NAME READY UP-TO-DATE AVAILABLE AGE
gitlab-runner-gitlab-runner 1/1 1 1 5d23h
test-nfs 0/1 1 0 10d
但是无法删除,删除时报错如下:
zhangxiaofans-MacBook-Pro:Downloads joe$ kubectl delete deployment test-nfs
Error from server (NotFound): the server could not find the requested resource
原因
首先需要明确 Error from server (NotFound): the server could not find the requested resource 这个类型的错误可能的原因很多,比如 权限不足,命名空间不一致,证书过期等等。
我这里 用的是 k8s的新版本集群,但是 kubectl 命令的客户端是老版本的,老版本的kubectl命令无法识别 新集群的一些 apiversion 导致的。
使用kubectl version命令查看
发现 集群时1.17版本 kubectl客户端命令是 1.10老版本。
解决方案
安装新版本的kubectl命令客户端
参考
还没有评论,来说两句吧...