Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kubernetes Readiness probe failed error

While running my container on kubernetes using helm upgrade command, I am getting this error:

'Readiness probe failed: Get http://172.17.0.6:3003/: dial tcp 172.17.0.6:3003: getsockopt: connection refused'.

My docker image is for a node.js application and I am trying to manage it through minikube.

like image 806
Karan Sodhi Avatar asked Jan 31 '18 11:01

Karan Sodhi


People also ask

How do you fix readiness probe failure?

Increase the Timeout of the Readiness Probe To increase the Readiness probe timeout, configure the Managed controller item and update the value of "Readiness Timeout". By default it set to 5 (5 seconds). You may increase it to for example 30 (30 seconds).

What happens if readiness probe fails?

If the readiness probe fails, the endpoints controller removes the Pod's IP address from the endpoints of all Services that match the Pod. The default state of readiness before the initial delay is Failure . If a container does not provide a readiness probe, the default state is Success .

Why do liveness probes fail?

The liveness probe will be marked as failed when the container issues an unhealthy response. The probe is also considered failed if the service doesn't implement the gRPC health checking protocol.

What is readiness probe Kubernetes?

Define readiness probes Kubernetes provides readiness probes to detect and mitigate these situations. A pod with containers reporting that they are not ready does not receive traffic through Kubernetes Services. Note: Readiness probes runs on the container during its whole lifecycle.


2 Answers

For anyone else here, if using helm to manage your deployments, you need to set initialDelaySeconds it in the deployments.yaml template in the /templates folder under livenessProbe. The livenessProbe will force restart your pod if the probe cannot connect, as was happening with mine. It wasn't giving my application enough time to build.

like image 92
Dane Jordan Avatar answered Sep 21 '22 21:09

Dane Jordan


This could be solved by increasing the initial delay in the readiness check. Actually since the connection to the DB was taking more then the initial delay as a result of which the readiness probe was failing.

like image 42
Karan Sodhi Avatar answered Sep 21 '22 21:09

Karan Sodhi