Search code examples
kuberneteskubernetes-podkubernetes-deployment

"Error from server (NotFound): deployments.apps "wordpress" not found" I am getting this error although I've deployed it?


I'm trying to deploy the pod that I've already created as a service but I keep getting the aforementioned error.

The first error is because I had already deployed the pods the other day. But the second error is the main problem.

enter image description here

It would be great if anyone could help me out.


Solution

  • kubectl run ...
    

    is used to create and run a particular image in a pod. [reference]

    kubectl expose ...
    

    is used to expose a resource (pod, service, replicationcontroller, deployment, replicaset) as a new k8s service. [reference]

    What you are doing is create a pod with kubectl run and expose a deployment with kubectl expose deployment. Those are two different resources. That's why you are getting NotFound error - because specified deployment does not exist.

    What you can do is either

    kubectl expose pod ...
    

    or create a deployment.