Liveness probe failing for gitlab auto-deploy-app container

11/5/2018

I’m setting up Gitlab Auto DevOps using Kubernetes. When deploying, I am getting this error for the auto-deploy-app container: Liveness probe failed: Get http://xx.xx.xx.xx:5000/: dial tcp xx.xx.xx.xx:5000: getsockopt: connection refused

Has anyone run into this?

-- ravi kiran mahankali
gitlab-ci
kubernetes

1 Answer

2/18/2019

I had the same problem. It can have many reasons.

  • You should make sure that your application returns a 200 OK on the basepath "/" and not e.g. a redirect, as this makes your health check fail.

  • Make sure you allow HTTP GET requests without authentication on the basepath "/".

  • Another more tricky reason is that your application startup time might exceed the initialDelay of liveness/readiness probe and thus the check fails too often before the application is even ready. In that case either add more CPU power or increase the delay in the liveness probe.

See this issue for more information on the second reason: https://github.com/kubernetes/kubernetes/issues/62594#issuecomment-420685737

The readiness/liveness probe initialDelay time can be modified by setting the respective value for the helm charts. E.g. in the deploy function add

helm upgrade --install \
        --wait \
        --set livenessProbe.initialDelaySeconds="60" \
        --set readinessProbe.initialDelaySeconds="60" \
        ...

To the helm chart upgrades.

-- kaikun
Source: StackOverflow