<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=521127644762074&amp;ev=PageView&amp;noscript=1">
Skip to main content

Why Do My Kubernetes Pods Keep Restarting?

23 November, 2026 | by Husne Ozmen

Kubernetes pods usually keep restarting for one of three reasons: the application inside the container is crashing, the container is running out of memory and being killed (OOMKilled), or a liveness probe is failing and the kubelet is restarting the container on purpose. The fastest way to tell which one you're dealing with is to run kubectl describe pod and look at the container's last state, reason, and exit code, then read the logs from the previous run with kubectl logs --previous.

A restart count that keeps climbing is Kubernetes doing its job: it noticed a container stopped and started it again. The restart is the symptom. This guide walks through how to find the cause, what each one looks like, and how to stop it from happening again.

How Do I Find Out Why a Pod Restarted?

  1. Confirm the restarts. Run kubectl get pods and check the RESTARTS column. A status of CrashLoopBackOff means the container has failed repeatedly, and Kubernetes is waiting longer between each attempt.
  2. Describe the pod. Run kubectl describe pod <pod-name> and find the container's Last State. The Reason and Exit Code there usually point straight to the cause.
  3. Read the previous run's logs. Run kubectl logs <pod-name> --previous. Without --previous, you see the logs of the current run, which may have only just started.
  4. Check the events. The events at the bottom of kubectl describe show probe failures, kills, and scheduling problems, in order.

Here's how to read what you find:

What you see

Likely cause

Reason OOMKilled, exit code 137

The container went over its memory limit

Reason Error, exit code 1 or another non-zero code

The application crashed or exited with an error

A "Liveness probe failed" event just before the restart

The kubelet restarted the container because a liveness probe failed

Exit code 137 without OOMKilled

The container was force-killed, often after failing a liveness probe and not shutting down in time

Status Init:CrashLoopBackOff

An init container is failing, so the main container never starts

One caution about exit code 137: it means the container received a kill signal, not specifically that it ran out of memory. Always check the reason alongside the code.

Cause 1: The Application Is Crashing

If the last state shows Error with a non-zero exit code, the process inside the container exited on its own. Kubernetes restarts it, it fails again, and after a few rounds the pod lands in CrashLoopBackOff.

The logs from the previous run almost always explain why. The usual suspects:

  • Missing configuration. An environment variable, Secret, or ConfigMap the app expects isn't there, or has the wrong value.
  • An unavailable dependency. The app exits at startup because it can't reach a database or another service it needs.
  • The wrong command. The container's command or entrypoint points at something that doesn't exist or exits immediately.
  • A bug. A code change that crashes on startup or under a particular request.

If the app crashes because a dependency isn't ready yet, retrying inside the application is usually a better fix than letting Kubernetes restart it over and over. For a full walkthrough, see How Do I Fix CrashLoopBackOff in Kubernetes (Step-by-Step)?

Cause 2: The Container Ran Out of Memory (OOMKilled)

If the last state shows OOMKilled with exit code 137, the container used more memory than its limit allows, and the Linux kernel killed it. Kubernetes then starts it again, often to run out of memory the same way.

There are two common reasons:

  • The limit is too low for what the workload genuinely needs, especially at peak traffic or during startup.
  • The application has a memory leak, so usage climbs steadily until it hits the limit, no matter how high you set it.

To tell them apart, look at memory usage over time. A container that spikes at certain moments needs a higher limit. One that climbs in a steady line until it's killed has a leak, and raising the limit only delays the next restart.

Applications that size their own memory at startup, like many JVM services, also need their internal settings to match the container's limit. Otherwise they can try to use more memory than Kubernetes allows. For more detail, see 5 Ways You Can Diagnose & Prevent OOMKilled Errors in Kubernetes.

Cause 3: A Liveness Probe Is Failing

A liveness probe is a regular check the kubelet runs to decide whether a container is still healthy. When it fails enough times in a row, the kubelet restarts the container. That's useful for an app that's deadlocked. It's also one of the most common causes of unnecessary restarts, because a misconfigured probe can restart a container that was working fine.

In the events, you'll see "Liveness probe failed" followed by a message that the container will be restarted. The usual causes:

  • The app starts slower than the probe expects. The probe begins checking before the app is ready, fails, and the container is restarted before it ever finishes starting. A startup probe fixes this: it holds off the liveness probe until the app is up.
  • The probe checks the wrong thing. A liveness probe that calls a database or another service will fail whenever that dependency has a problem, restarting containers that can't fix it. Liveness should only check whether the app itself is alive.
  • The thresholds are too strict. A short timeout or low failure threshold turns a brief slowdown into a restart.

It also helps to know what each probe does:

Probe

What happens when it fails

Liveness

The container is restarted

Readiness

The pod stops receiving traffic, but isn't restarted

Startup

The container is restarted, and liveness and readiness checks wait until it passes

If a check is about whether the app should get traffic right now, it belongs in a readiness probe. See Guide to Understanding Your Kubernetes Liveness Probes Best Practices for more.

When It Isn't Actually a Restart

Sometimes pods seem to restart, but the restart count stays at zero and the pod has a new name. That isn't a container restart. The old pod was removed and a new one was created in its place. Common reasons:

  • Eviction. When a node runs low on memory or disk, the kubelet evicts pods to protect the node. Evicted pods show the status of Evicted.
  • Preemption. A higher-priority pod needed the space, so the scheduler removed a lower-priority one.
  • Node changes. A node was drained for an upgrade, scaled down by the autoscaler, or replaced.
  • Deployments. A rollout replaces old pods with new ones.

These show up in cluster events rather than in the container's last state. If pods are being replaced often, look at node pressure and resource requests, not the application.

How Do I Stop Pods From Restarting?

Fixing the restart in front of you is step one. Preventing the next one mostly comes down to configuration that's easy to get wrong and easy to check:

  • Set memory requests and limits from real usage. Guesses made at launch are the main source of OOMKilled restarts. Open source Goldilocks recommends requests and limits based on what your workloads actually use.
  • Give every container sensible probes. Use a startup probe for slow-starting apps, keep liveness probes focused on the app itself, and put dependency checks in readiness probes.
  • Standardize the defaults. Shared deployment templates or Helm charts with sane probe and resource settings stop each team from rediscovering the same problems.
  • Check configuration before it ships. Open source Polaris flags missing probes, missing resource settings, and other common misconfigurations, and can run in CI so problems are caught before they reach a cluster.
  • Alert on restart counts. A container that restarts a few times a day often goes unnoticed until it becomes an outage.

In some cases our client team reported jobs getting kicked off and failing for no reason. When we tracked down the issue, we found that on a new node the jobs land first. When a new pod shows up with a higher priority (system-node-critical) that needs CPU/memory, Kubernetes will kick off a running job to make room. Those previously runnin jobs have backoffLimit: 0, so they fail and do not retry.

We solved the problem by keeping the node closed to jobs until the system-node-critical pod is already on it. Then open the node so jobs can use whatever capacity is left, and the agent does not have to evict anyone.

In another example, there was a deployment whose pods would not stay up. Pods were kept getting restarted, and the events on kubectl describe pod showed Liveness probe failed just before each restart. The probe had a short timeout and a low failure threshold, so the first change was to loosen it to a longer initialDelaySeconds and a higher failureThreshold. But that alone didn’t solve the restarts.

It turned out the trigger was a feature we had just turned on. This feature added a sidecar whose port was also named http, the same name the existing container already used. Because port names have to be unique in the pod, the probe was no longer checking the container it was meant to check. We opened a pull request against the upstream Helm chart to give the sidecar port its own name, and in the meantime applied that rename with a Kustomize patch. Once the chart shipped the fix, we removed the patch and went back to the chart default. The restarts stopped. Raising the probe thresholds had only slowed the loop down.

If you want these checks running continuously across every cluster, Fairwinds Insights brings Polaris, Goldilocks, and other checks together in one place.

Frequently Asked Questions

What does CrashLoopBackOff mean?

It means a container has failed repeatedly, and Kubernetes is waiting a little longer before each new attempt to start it. It's a status, not a cause. The cause is in the container's last state, its logs, and the pod's events.

What does exit code 137 mean in Kubernetes?

The container was killed with a SIGKILL signal. The most common reason is running out of memory, in which case the reason shows OOMKilled. It can also mean the container was force-stopped after failing a liveness probe.

Does a failing readiness probe restart a pod?

No. A failing readiness probe only stops traffic from reaching the pod. Only liveness and startup probe failures restart the container.

How do I see the logs from a container that already crashed?

Run kubectl logs <pod-name> --previous. That shows the output of the last run before the restart, which is usually where the error is.

Why did my pod's restart count go back to zero?

The pod was replaced, not restarted. Restart counts belong to a specific pod, so a new pod from an eviction, a node change, or a rollout starts counting from zero.