kubectl create doesn't seem to do anything

12/12/2018

I am running the command

kubectl create -f mypod.yaml --namespace=mynamespace

as I need to specify the environment variables through a configMap I created and specified in the mypod.yaml file. Kubernetes returns

pod/mypod created

but kubectl get pods doesn't show it in my list of pods and I can't access it by name as if it does not exist. However, if I try to create it again, it says that the pod is already created.

What may cause this, and how would I diagnose the problem?

-- zcleghern
kubernetes

1 Answer

12/12/2018

By default, kubectl commands operate in the default namespace. But you created your pod in the mynamespace namespace.

Try one of the following:

kubectl get pods -n mynamespace
kubectl get pods --all-namespaces
-- Oliver Charlesworth
Source: StackOverflow