View log files of crashed pods in kubernetes

后端 未结 4 1870
隐瞒了意图╮
隐瞒了意图╮ 2021-02-01 01:10

Any idea to view the log files of a crashed pod in kubernetes? My pod is listing it\'s state as \"CrashLoopBackOff\" after started the replicationController. I search the availa

4条回答
  •  花落未央
    2021-02-01 01:30

    kubectl logs command only works if the pod is up and running. If they are not, you can use the kubectl events command.

    kubectl get events -n  --sort-by='.metadata.creationTimestamp'
    

    By default it does not sort the events, hence the --sort-by flag.

提交回复
热议问题