1
votes

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
1
Probably your application needs more time to start. Try increasing initialDelaySeconds in probe settings.Vasili Angapov
@VasiliAngapov delay is not a problem, application starts immediately.9ilsdx 9rvj 0lo
Can you add your probe configuration and how you tested using CURLBala
Could you provide some details about your environment (local, cloud, if yes which one). Your configuration would be also helpful. What is error message? Any suspecting entries in the logs?PjoterS

1 Answers

2
votes

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.