Istio: "A container name must be specified for pod"

Created on 18 Apr 2018  路  7Comments  路  Source: istio/istio

Hi

Setup Kubernetes:

kubectl version
Client Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.6", GitCommit:"6260bb08c46c31eea6cb538b34a9ceb3e406689c", GitTreeState:"clean", BuildDate:"2017-12-21T06:34:11Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.6", GitCommit:"9f8ebd171479bec0ada837d7ee641dec2f8c6dd1", GitTreeState:"clean", BuildDate:"2018-03-21T15:13:31Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}

Running the Bookinfo sample app I get the following, do you know why?

kubectl logs productpage-v1-84f77f8747-8zklx

Error from server (BadRequest): a container name must be specified for pod productpage-v1-84f77f8747-8zklx, choose one of: [productpage istio-proxy] or one of the init containers: [istio-init]

Most helpful comment

@JCzz - When retrieving logs for pods that have multiple containers, you need to specify the container you want the logs for.

For example:

$ kubectl logs productpage-v1-84f77f8747-8zklx -c productpage

The reason is because Istio adds a second container to deployments via the istio-sidecar-injector. This is what adds the envoy proxy in front of all of your pods traffic.

All 7 comments

@JCzz - When retrieving logs for pods that have multiple containers, you need to specify the container you want the logs for.

For example:

$ kubectl logs productpage-v1-84f77f8747-8zklx -c productpage

The reason is because Istio adds a second container to deployments via the istio-sidecar-injector. This is what adds the envoy proxy in front of all of your pods traffic.

@bobbytables

Ahh I see, thanks Robert

This appears to be resolved. Closing.

I had the same issue. Thanks!

Could anyone specify how to fix this kind of issue? I get same issue now.

Got here too and thanks for the info.
@niurm you probably have multiple containers, so you have to pick one with -c option given by @bobbytables above.

@binhn Thanks for your update. For my case, (on Openshift), confirm logs with "oc logs -f mysql-0 -c mysql |more". The logs shows "[Note] Access denied for user '1000530000'@'localhost' (using password: NO)", It's related to permission. With adding "oc adm policy add-scc-to-user anyuid -z default", the issue was fixed. Thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

iroller picture iroller  路  3Comments

morvencao picture morvencao  路  4Comments

vadimeisenbergibm picture vadimeisenbergibm  路  4Comments

ebuono picture ebuono  路  3Comments

ZackButcher picture ZackButcher  路  4Comments