0

I am having a strange issue with the Liveness Probe constantly failing but connecting into the Pod and checking the endpoint with cURL looks good.

Here is the output of the CURL command.

curl -v localhost:7000/health
* Expire in 0 ms for 6 (transfer 0x5595637270f0)
...
* Expire in 0 ms for 1 (transfer 0x5595637270f0)
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Expire in 150000 ms for 3 (transfer 0x5595637270f0)
* Expire in 200 ms for 4 (transfer 0x5595637270f0)
* Connected to localhost (127.0.0.1) port 7000 (#0)
> GET /health HTTP/1.1
> Host: localhost:7000
> User-Agent: curl/7.64.0
> Accept: */*
> 
< HTTP/1.1 200 OK
< Server: gunicorn
< Date: Mon, 13 Feb 2023 19:41:44 GMT
< Connection: close
< Content-Type: text/html; charset=utf-8
< Content-Length: 24
< 
* Closing connection 0

Now here is the section of the YAML that has the probe for the Pod:

containers:
  - name: flask-container
    image: path
    imagePullPolicy: Always
    volumeMounts:
    - name: cert-and-key
      mountPath: /etc/certs
      readOnly: true
    ports:
    - containerPort: 7000
    livenessProbe:
      httpGet:
        path: /health
        port: 7000
        scheme: HTTP
      initialDelaySeconds: 20
      periodSeconds: 20
  imagePullSecrets:
  - name: pullsecret

For some reason the Liveness probe keeps failing after creating the Pod:

Liveness probe failed: Get "http://10.224.0.130:7000/health": dial tcp 10.224.0.130:7000: connect: connection refused

Thanks in advance for any pointers!

john
  • 1,561
  • 3
  • 20
  • 44

1 Answers1

0

Fixed. The issue was with the Docker image exposing the container on localhost or 127.0.0.1 instead of correctly exposing on 0.0.0.0.

john
  • 1,561
  • 3
  • 20
  • 44