Kubernetes http livenessProbe use https?

3/27/2020

We have an http livenessProbe setup

  livenessProbe:
    httpGet:
      path: /admin
      port: http
    initialDelaySeconds: 180
    periodSeconds: 20

but why in the description the connection is via https

Liveness probe failed: Get https://10.11.1.7:80/admin: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
-- deemaxx
kubernetes

1 Answer

3/27/2020

Kubernetes is doing exactly what you are asking, probing the http url but your application pod web server is redirecting it to https, that is causing the error.

You can either fix that in pod or use TCP probe

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
-- Arghya Sadhu
Source: StackOverflow