3
2

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.

Kubernetesで起動に失敗してしまうpodをデバッグする

Last updated at Posted at 2019-11-05

イメージ作った環境だと動くんだけどk8sにのっけると起動しなくて CrashLoopBackOff を繰り返す、ログを見てなんとなく原因はつかめるものの実際にそのイメージで動作している環境に入って調べればすぐわかるのに...というあなたに

止まったpodを作る

$ kubectl edit deploy して、以下のようにcommandでsleepを指定する。時間はいくらでもいい。

  spec:
    template:
      spec:
        containers:
        - command:
          - /bin/sleep
          - "3000"

podに入る

プロセス1番が寝ている間にこっそり入って色々する。

$ kubectl exec -it {$pod_name} /bin/bash

podを殺す

sleepしているpodはdeleteしても消えないしpodに入って kill -KILL 1 しても死なないので、
Kubernetesで消えないPodを強制的に削除する を参考に

$ kubectl delete pods {$pod_name} --grace-period=0 --force
3
2
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
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?