Kubernetes / kubectl - "A container name must be specified" but seems like it is? Kubernetes / kubectl - "A container name must be specified" but seems like it is? kubernetes kubernetes

Kubernetes / kubectl - "A container name must be specified" but seems like it is?


If a pod has more than 1 containers then you need to provide the name of the specific container.

in your case, There is a pod (postgres-operator-49202276-bjtf4) which has 2 containers (apiserver and postgres-operator ).following commands will provide logs for the specific containers

kubectl logs deployment/postgres-operator -c apiserverkubectl logs deployment/postgres-operator -c postgres-operator


A container name must be given if the pod is having more than one containers (as mentioned in above answers).

To know all the containers inside a pod we can use:

kubectl -n get pods <POD_NAME> -o jsonpath="{..image}"