Does k8s support https liveness and readness probe

12/19/2019

My app based on express node framework and start with https cert. So does k8s support https liveness probe? Schema is HTTPS. I think the liveness probe is send request via IP address, not domain. So it seems HTTPS schema actually doesn't work.

      livenessProbe:
        httpGet:
          path: /api/alive
          port: 8433
          scheme: HTTPS
-- 王若璇
kubernetes

1 Answer

12/19/2019

yes, it does. Both "HTTP" and "HTTPS" are supported. see below sample

apiVersion: v1
kind: Pod
metadata:
  labels:
    test: liveness
  name: liveness-http
spec:
  containers:
  - args:
    - /server
    image: k8s.gcr.io/liveness
    livenessProbe:
      httpGet:
        # when "host" is not defined, "PodIP" will be used
        # host: my-host
        # when "scheme" is not defined, "HTTP" scheme will be used. Only "HTTP" and "HTTPS" are allowed
        # scheme: HTTPS
        path: /healthz
        port: 8080
        httpHeaders:
        - name: X-Custom-Header
          value: Awesome
      initialDelaySeconds: 15
      timeoutSeconds: 1
    name: liveness

Note that If scheme field is set to HTTPS, the kubelet sends an HTTPS request to specified path (path: /healthz) and port (port: 8080 ) to perform the check skipping the certificate verification

-- P Ekambaram
Source: StackOverflow