Kubernetes CrashLoopBackOff? Step-by-Step Fix with Real Example (2026 Guide)
I pulled a MongoDB Docker image on my Mac, tagged it, pushed it to Azure Container Registry (ACR), and watched the pod crash the moment Kubernetes tried to run it on an Ubuntu node. If you've seen
exec format error buried inside your pod logs, you've hit the same wall. Here's exactly what happened and how I fixed it.What is CrashloopBackOff?
CrashLoopBackOff is one of the most common Kubernetes pod states that tells you: "The container started, crashed immediately, Kubernetes restarted it, it crashed again — and now I'm backing off before trying again."
Kubernetes applies an exponential backoff delay (10s → 20s → 40s → ... up to 5 minutes) between restart attempts. The CrashLoopBackOff status is not the root cause itself — it is a symptom. The actual reason is always buried in the pod logs or events.
What was the cause? Why i faced this isse?
CrashLoopBackOffimmediately.When an arm64 binary tries to execute on an amd64 CPU, the kernel simply cannot decode the instruction set and throws:
exec format errorThis error means: "I tried to execute this binary but it's compiled for a different CPU architecture." Kubernetes sees the container exit immediately (exit code 1 or 132) and enters the crash loop.
Real Example : what i faced?
I was using MongoDB for the project. I wrote the statefulset manifest for the DB
kubectl get pod -n mongodb
How to debug theCrashloopBackoff?
on log issueis exec /usr/local/bin/docker-entrypoint.sh: exec format error
CrashloopBackoff Step-by-step fix
The fix is to build (or pull) the image explicitly targeting linux/amd64, then push that to ACR.
Docker Buildx makes this straightforward, even from a Mac.:
fix 1: Pull the correct platform image explicitly
Use --platform to force Docker to pull the amd64 variant from the multi-arch manifest:
docker pull --platform linux/amd64 mongo:7.0
fix2: Alternative: build your own image with Buildx targeting amd64If you're building a custom image (not just retagging an official one), use docker buildx build to cross-compile and push in one command:
docker buildx build \ --platform linux/amd64,linux/arm64 \ --tag myregistry.azurecr.io/myapp:1.0 \ --push .
Restart the Kubernetes deployment
Verifyig the fix
--platform linux/amd64 at pull or build time is a one-liner fix that eliminates this class of error permanently for your team.FAQ
Why doesn't Docker warn me when I push an arm64 image?
Docker treats image pushing as architecture-agnostic — it just pushes whatever is tagged. ACR also accepts any image regardless of architecture. The mismatch only surfaces at runtime when the kernel tries to execute the binary.
Does this affect EKS or GKE, not just AKS?
Yes. Any Kubernetes cluster running on standard amd64 (x86-64) nodes — whether AKS, EKS, GKE, or self-managed — will fail to run arm64 images with the same exec format error.
What if I need to run an arm64 image on AKS?
AKS supports arm64 node pools using Azure's Ampere Altra-based virtual machines (Dpsv5 series). You would need to add an arm64 node pool and use node selectors or affinities to schedule arm64 workloads there. For most teams, re-building for amd64 is the simpler path.
Can I use Rosetta 2 / QEMU emulation to avoid rebuilding?
Docker Desktop uses QEMU to emulate architectures, which is why arm64 images might appear to "work" locally on Mac with emulation enabled. However, Kubernetes nodes don't have QEMU installed — they only run native binaries. Emulation is a local development convenience, not a production solution.
No comments:
Post a Comment