Search code examples
azurekubernetesazure-devopsterminalkubectl

Kubectl is not letting me deleting anything - How do I delete all the current deployments?


I ran this command to create my pod:

kubectl run my-ngnix --image nginx

Now, I'm trying to delete the pod/deployment with the following command:

kubectl delete deployment my-nginx

The problem is that my terminal is telling me that is not possible. Since it couldn't found the right info.

Error from server (NotFound): deployments.apps "my-nginx" not found

If ask for all, this is what I see:

 kubectl get all
NAME           READY   STATUS    RESTARTS   AGE
pod/my-ngnix   1/1     Running   0          27m

NAME                 TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
service/kubernetes   ClusterIP   10.0.0.1     <none>        443/TCP   159m
root@aharo003:~# kubectl stop pods,services -l pod/m-ngnix

Does someone know what else should I have to do?


Solution

  • kubectl get all shows you the resources you created

    in this case it starts with the kind and the resource name.

    You can easily type kubectl delete pod/my-ngnix to delete the pod. Your command kubectl run my-ngnix --image nginx created just the pod without a deployment.