restart count 47 and climbing. what is my cron job trying to tell me?

Solveddebuggingkubernetespods5 replies · 180 views · started
Accepted solution by Ines Dubois — Get the logs of teh previous (crashed) container, not the current one: [code] In describe, look at Last State: teh Reason and Exit Code…
  1. Deployed our cron job to GKE and it never becomes ready:

    kubectl get pods shows CrashLoopBackOff and a growing restart count. kubectl logs returns nothing at all. The same image runs fine with docker run on my laptop. Where do I look?

    The deployment manifest was mostly copied from another service that works fine, so I assumed it would just run. Clearly not. I'd love to learn the proper debugging flow for this instead of randomly changing YAML and redeploying.

    cry

    3
  2. wait what do Last State, Reason and Exit Code say in kubectl describe pod??

    2 0 helpful
  3. Exit code 0 with CrashLoopBackOff means the main process ends lol Containers must run a foreground process. A command that daemonizes, or a script that finishes, causes exactly this. Check command and args in the pod spec override the image CMD the way u expect. worked for me anyway 🤷

    2 0 helpful
  4. Get the logs of teh previous (crashed) container, not the current one:

    kubectl logs <pod> --previous
    kubectl describe pod <pod>
    

    In describe, look at Last State: teh Reason and Exit Code tell u a lot. OOMKilled / 137 is memory, Error / 1 is teh app exiting, Completed / 0 means teh porcess just finished.

    0 5 helpful
  5. @idubois WOWWW logs --previous pointed straight at a missing Secret key. fixed the name and the cron job is Running with zero restarts. u guys are the best!!!

    thumbsup

    2 2 helpful

Reply to this topic

Sign in or create an account to reply.