<p>According to the documentation: <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/</a></p>
<blockquote>
<p>Any code greater than or equal to 200 and less than 400 indicates
success. Any other code indicates failure.</p>
</blockquote>
<p>so if the container returns <code>301</code> for the probe, the probe should succeed. But I have a container in which it's not the case. With CURL I get <code>301</code>, but probe fails with <code>503</code>. The target of the redirect is not available.</p>
<p>Tested in Openshift 3.11 with the following probe:</p>
<pre class="lang-yaml prettyprint-override"><code>    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
</code></pre>

<p>This topic was already rised in Github - <a href="https://github.com/kubernetes/kubernetes/issues/73172" rel="nofollow noreferrer">kubelet's httpProbe follow redirects</a></p>
<p>According to <code>@thockin</code> tests in <a href="https://github.com/kubernetes/kubernetes/issues/73172#issuecomment-472499665" rel="nofollow noreferrer">this comment</a>, current <code>probes</code> configuration  allows <code>HTTP probes</code> to redirecting and it's current behavior.</p>
<blockquote>
<p>c) fix docs and follow redirects wherever they lead (current behavior)</p>
</blockquote>
<p>I've check changelogs and this behavior was not changed.</p>
<p>In addition you can check <a href="https://github.com/caddyserver/caddy/issues/3441#issuecomment-633154665" rel="nofollow noreferrer">this thread</a> with similar issue, when response is <code>301</code>.</p>
