Kubernetes Readiness probe sends 401 Response

9/4/2019

When trying to enable kubernetes rolling update with following configurations, newly created pod shows HTTP probe failed with statuscode:401

configurations:

spec:
  replicas: 1
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 25%
      maxSurge: 1

containers:
          imagePullPolicy: Always
          readinessProbe:
            httpGet:
              path: /actuator/health
              port: 8065
            initialDelaySeconds: 20
            periodSeconds: 5
            successThreshold: 1

Error on newly created pod:

Warning  Unhealthy         0s (x2 over 5s)        kubelet, aks-agentpool-26902276-0  Readiness probe failed: HTTP probe failed with statuscode: 401

And from the logs it can be seen that both new pod and both pods are running.

What could be the possible reason to receive HTTP 401 for readiness call? As per my understanding this is a internal call within Kubernetes and doesn't involve authentication. Pod is a Spring Boot application

As Explained here, there is no need to authorize requests to spring /health endpoint and it works fine when running application locally. (I can get http 200 response from this endpoint)

By default only health information is shown to unauthorized access over HTTP

-- Channa
kubernetes
spring-boot

1 Answer

9/5/2019

In my case issue was not adding spring-boot-starter-actuator dependency

   <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
-- Channa
Source: StackOverflow