Kubernetes Readiness probe failed error

1/31/2018

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.

-- Karan Sodhi
docker
kubernetes-helm
minikube

3 Answers

8/20/2018

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.

-- Dane Jordan
Source: StackOverflow

2/16/2018

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.

-- Karan Sodhi
Source: StackOverflow

8/22/2019

Helm:

I would recommend setting the initialDelaySeconds value in the values.yaml file and use an action {{ .Values.initialDelaySeconds }} to insert the value into the deployment.yaml template.

kubectl:

Just add the initialDelaySeconds: 5 if you want 5 seconds to your (deployment,pod,replicate set etc) manifest and apply your changes.

If it fails, get coffee and start looking at logs from the container

kubectl logs -h for more help

-- Margach Chris
Source: StackOverflow