My kubernetes pods keep crashing with “CrashLoopBackOff” but I can't find any log

前端 未结 15 1843
耶瑟儿~
耶瑟儿~ 2020-11-29 22:40

This is what I keep getting:

[root@centos-master ~]# kubectl get pods
NAME               READY     STATUS             RESTARTS   AGE
nfs-server-h6nw8   1/1           


        
15条回答
  •  余生分开走
    2020-11-29 23:30

    In my case the problem was what Steve S. mentioned:

    The pod is crashing because it starts up then immediately exits, thus Kubernetes restarts and the cycle continues.

    Namely I had a Java application whose main threw an exception (and something overrode the default uncaught exception handler so that nothing was logged). The solution was to put the body of main into try { ... } catch and print out the exception. Thus I could find out what was wrong and fix it.

    (Another cause could be something in the app calling System.exit; you could use a custom SecurityManager with an overridden checkExit to prevent (or log the caller of) exit; see https://stackoverflow.com/a/5401319/204205.)

提交回复
热议问题