Restart count 47 and climbing. What is my worker pod trying to tell me??

Solveddebuggingkubernetespods14 replies · 400 views · started
Accepted solution by Daria Schmidt — ok so liveness probes can kill a healthy but slow app, if describe shows Liveness probe failed events before restarts, increase…
  1. long time lurker first post lol deployed our worker pod 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 latpop. Where do i look?

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

    1
  2. uhh any Liveness probe failed events before the restarts?

    5 0 helpful
  3. help!! lol this thread is gold. wait does this also apply to debugging? pls help 🙏

    0 6 helpful
  4. ahh right events show liveness probe failures about 10 seconds after each start. The app needs longer than that to boot on GKE. hope thats enough info 😅

    32 0 helpful
  5. came here to say exactly this. reading this at 2am instead of sleeping, no regrets lmk how it goes

    4 1 helpful
  6. lol same thing happened to me get the logs of the previous (crashed) container, not teh current one:

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

    In describe, look at Last State: the Reason and Exit Code tell u a lot. OOMKilled / 137 is memory, Error / 1 is the app exiting, Completed / 0 means the process just finished. good luck man!

    5 2 helpful
  7. If the image works locally but not in the cluster, check securityContext: many clusters run with runAsNonRoot or a read-only root filesystem, an app that writes to its own directory or binds port 80 as non-root will crash. hope that helps :)

    31 0 helpful
  8. For debugging, override the command to keep the container alive (command: ["sleep", "3600"]) and kubectl exec in to run the entrypoint by hand. Or use kubectl debug with an ephemeral container if your cluster supports it.

    lol

    0 5 helpful
  9. ahh classic missing config is a top cause: a ConfigMap or Secret key that doesnt exist, a wrong env var name, or teh app cant reach its database at startup and exits. Compare kubectl get pod <pod> -o yaml env section with what the app expects. fingers crossed 🤞

    23 0 helpful
  10. Accepted solution

    ok so liveness probes can kill a healthy-but-slow app, if describe shows Liveness probe failed events before restarts, increase initialDelaySeconds, or better, add a startupProbe so livenses only starts checking after the app is up.

    0 5 helpful
  11. wait what i'd add a proper readiness/startup probe setup to your base Helm chart so every team gets sane defaults instead of fixing this per wrokload.

    15 0 helpful
  12. @proxytrace logs --previous pointed straight at a missing Secret key. Fixed teh name and the worker pod is Running with zero restarts. cant believe it was that simple lol

    0 1 helpful

Reply to this topic

Sign in or create an account to reply.