<p>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 <a href="http://xx.xx.xx.xx:5000/" rel="nofollow noreferrer">http://xx.xx.xx.xx:5000/</a>: dial tcp xx.xx.xx.xx:5000: getsockopt: connection refused</p>

<p>Has anyone run into this?</p>

<p>I had the same problem. It can have many reasons. </p>

<ul>
<li><p>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.</p></li>
<li><p>Make sure you allow HTTP GET requests without authentication on the basepath "/".</p></li>
<li><p>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.</p></li>
</ul>

<p>See this issue for more information on the second reason: <a href="https://github.com/kubernetes/kubernetes/issues/62594#issuecomment-420685737" rel="nofollow noreferrer">https://github.com/kubernetes/kubernetes/issues/62594#issuecomment-420685737</a></p>

<p>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 </p>

<pre><code>helm upgrade --install \
        --wait \
        --set livenessProbe.initialDelaySeconds="60" \
        --set readinessProbe.initialDelaySeconds="60" \
        ...
</code></pre>

<p>To the helm chart upgrades.</p>
