Kubernetes: Pod failinig with: exec user process caused "exec format error"

kubernetes exec format error pod

2 min read | by Jordi Prats

A Pod can fail to run with the following error:

standard_init_linux.go:178: exec user process caused "exec format error"

Might be confusing at first sight, but what it is trying to tell us is that there's a problem executing the code. If it is a binary, the issue usually is that you are trying to execute a binary that was built for a different architecture (some mismatch)

So it could be that you are trying to run a x86_64 binary on ARM64 or the other way around. In case the problem is that you are running Kubernetes nodes with mixed architecture you have several options:

  • Build a multiarch container with docker buildx or nerdcrl
  • Use a nodeSelector with a label such as kubernetes.io/arch to be able to select the nodes running with the architecture the container requires:
apiVersion: v1
  kind: Pod
  metadata:
  name: demo
  spec:
  nodeSelector:
      kubernetes.io/arch: arm
  containers:
      - name: demo
      image: busybox
      command: ["sleep"]
      args: ["1h"]

Posted on 24/11/2022

Categories