1
0

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 5 years have passed since last update.

k8sのログ取りについて

1
Posted at

初めに

最近業務で触り始めたので、備忘録として簡単にまとめる程度として記載します。ちらっと調べている範囲でもより取り方を見かけるので、そちらの技術を用いる方がいいのかもしれません。

kubectl logs [podname]

podで標準出力されているログを確認する。オプションに--since [n]sでコマンド実行からn秒前のログを表示できる。sではなくmにすると分単位になる。-ftail -fのようにリアルタイムに表示してくれる。podが死ぬと表示も止まり、通常のコンソール状態になる。

kubectl describe pod [podname]

これで実際にpod起動時のコマンドや、ホストと共有しているディレクトリの情報、podのステータスがpendingで止まっているときの理由が表示されたりする。

終わり

触り始めたばかりですが、これである程度の情報が集められるのでおうちクラスタ組んだりする程度で実サービスをデプロイするとかでなければイケるかもです。もし「こんな便利コマンドあるよ!!」とかございましたらコメントいただけると嬉しいです。

1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?