Damian
Damian

Reputation: 3050

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

I get the server could not find the requested resource error when I try to delete a deployment, event when it is listed.

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

Upvotes: 0

Views: 722

Answers (1)

Arghya Sadhu
Arghya Sadhu

Reputation: 44569

You can use any of below commands to delete the deployment but make sure kubectl client and kubernetes api server version matches Because in 1.16 version deployments is migrated to apps/v1 from extensions/v1beta1. So if you have a kubectl client which is of older version it will not be able to find the deployment in apps api version.

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

Upvotes: 3

Related Questions