5
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Kubernetesで「error: a container name must be specified for pod」エラーが発生したときの対処方法

Last updated at Posted at 2020-09-20

エラー内容

Kubernetesで複数コンテナを含むDeploymentのLogを確認しようとした際に、以下のエラーが発生しました。

$ kubectl logs pod/app-664dd8bdf5-cq62j
error: a container name must be specified for pod app-664dd8bdf5-cq62j, choose one of: [app web]

解消方法

複数コンテナを含むPodのログを確認しようとしていたため、複数コンテナのうちのどのログを見るのか、-cオプションで指定してあげる必要がありました。

$ kubectl logs pod/app-664dd8bdf5-cq62j -c web
5
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?