Kubernetes 不允许删除部署 - 服务器找不到请求的资源

Kubernetes not allowing to delete a deployment - the server could not find the requested resource

当我尝试删除列出的部署、事件时出现 the server could not find the requested resource 错误。

D:\cmd
λ kubectl -n gdpr-tr get all
NAME                                              READY     STATUS             RESTARTS   AGE
pod/scv-turkey-iys-integration-6dd784689f-z6hqc   0/1       InvalidImageName   0          1m
pod/scv-turkey-iys-integration-79c4d7ffcd-pwmq4   0/1       ErrImagePull       0          6m

NAME                                         DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/scv-turkey-iys-integration   1         2         1            0           1h

NAME                                                    DESIRED   CURRENT   READY     AGE
replicaset.apps/scv-turkey-iys-integration-6998c5b5f9   0         0         0         1h
replicaset.apps/scv-turkey-iys-integration-6dd784689f   1         1         0         34m
replicaset.apps/scv-turkey-iys-integration-79c4d7ffcd   1         1         0         25m

D:\cmd
λ kubectl -n gdpr-tr delete deployment.apps/scv-turkey-iys-integration
Error from server (NotFound): the server could not find the requested resource

您可以使用以下任何命令删除部署,但请确保 kubectl 客户端和 kubernetes api 服务器版本匹配 因为在 1.16 版本中部署从 extensions/v1beta1 迁移到 apps/v1。因此,如果您有一个旧版本的 kubectl 客户端,它将无法在 apps api 版本中找到部署。

kubectl -n gdpr-tr delete deployment scv-turkey-iys-integration 
kubectl -n gdpr-tr delete deployments/scv-turkey-iys-integration