kubernetesreadinessprobe

Do Kubernetes http probes follow redirects?


According to the documentation: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/

Any code greater than or equal to 200 and less than 400 indicates success. Any other code indicates failure.

so if the container returns 301 for the probe, the probe should succeed. But I have a container in which it's not the case. With CURL I get 301, but probe fails with 503. The target of the redirect is not available.

Tested in Openshift 3.11 with the following probe:

    apiVersion: apps/v1
    kind: Deployment
    spec:
      template:
        spec:
          containers:
            - name: 'redirect'
              image: ngingx
              ports:
                - name: http
                  containerPort: 8080
                  protocol: TCP
              livenessProbe:
                httpGet:
                  path: /
                  port: http
              readinessProbe:
                httpGet:
                  path: /
                  port: http

Solution

  • This topic was already rised in Github - kubelet's httpProbe follow redirects

    According to @thockin tests in this comment, current probes configuration allows HTTP probes to redirecting and it's current behavior.

    c) fix docs and follow redirects wherever they lead (current behavior)

    I've check changelogs and this behavior was not changed.

    In addition you can check this thread with similar issue, when response is 301.