Search code examples
kuberneteskubernetes-pod

Liveness probe failed: OCI runtime exec failed


I want to set a liveness probe. I am using a script to run a curl command. However i can see the liveness probe is failing with the following error:

kubectl describe pod <>

Warning Unhealthy 4m5s (x2 over 7m5s) kubelet Liveness probe failed: OCI runtime exec failed: exec failed: container_linux.go:380: starting container process caused: exec format error: unknown

Liveness: exec [./livenessprobe.sh] delay=180s timeout=120s period=180s #success=1 #failure=2

deployment.yaml

        livenessProbe:
          exec:
            command:
            - ./livenessprobe.sh 
          initialDelaySeconds: 180 
          periodSeconds: 180
          timeoutSeconds: 120
          failureThreshold: 2
          successThreshold: 1

If i exec into the pod and run ./livenessprobe.sh i get the correct response. It is just a curl command

./livenessprobe.sh

curl --fail -H "Authorization: Basic <redacted>==" -H "Content-Type: application/json" -H "x-geeiq-origin: liveness-probe" -i -X POST -d @livenessprobe-request.json http://0.0.0.0:8080/

Solution

  • I was able to get this working by altering the command.

    command:
    - /bin/sh
    - livenessprobe.sh