<p>I am deploying some web app on kubernetes and I want to set liveness probe for this application.
When I configure my deployment with liveness probe, kubelet start health check. I was defined httpGet with scheme &quot;HTTP&quot; parameter but kubelet using https schema randomly.</p>
<p>This is my liveness probe configuration:</p>
<pre><code>livenessProbe:
  failureThreshold: 4
  httpGet:
    path: /
    port: 80
    scheme: HTTP
  initialDelaySeconds: 40
  periodSeconds: 5
  successThreshold: 1
  timeoutSeconds: 2
</code></pre>
<p>This is result from kubelet:</p>
<p>kubectl describe pod greenlight-7877dc58b7-6s78l</p>
<p>output:</p>
<blockquote>
<p>Warning  Unhealthy  31s (x4 over 46s)  kubelet            Liveness
probe failed: Get &quot;https://10.244.4.182/&quot;: dial tcp 10.244.4.182:443:
connect: connection refused</p>
</blockquote>
<p>Kubernetes version: v1.19.9</p>
<p>Thanx for help!</p>

<p>Since you are explicitly stating livenessProbe to use HTTP, it's probably your application that redirects traffic to HTTPS. Make sure that your application returns a <code>200 OK</code> on basepath <code>/</code>, and not a redirection (any of <code>3xx</code> codes).</p>
<p>You can either fix that, or use <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#define-a-tcp-liveness-probe" rel="nofollow noreferrer">TCP probe</a></p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: goproxy
  labels:
    app: goproxy
spec:
  containers:
  - name: goproxy
    image: k8s.gcr.io/goproxy:0.1
    ports:
    - containerPort: 8080
    readinessProbe:
      tcpSocket:
        port: 8080
      initialDelaySeconds: 5
      periodSeconds: 10
    livenessProbe:
      tcpSocket:
        port: 8080
      initialDelaySeconds: 15
      periodSeconds: 20
</code></pre>
