Spring boot Kubernetes准备就绪探测器发送401响应
当尝试使用以下配置启用kubernetes滚动更新时,新创建的pod显示HTTP探测失败,状态代码:401 配置:Spring boot Kubernetes准备就绪探测器发送401响应,spring-boot,kubernetes,Spring Boot,Kubernetes,当尝试使用以下配置启用kubernetes滚动更新时,新创建的pod显示HTTP探测失败,状态代码:401 配置: spec: replicas: 1 strategy: type: RollingUpdate rollingUpdate: maxUnavailable: 25% maxSurge: 1 containers: imagePullPolicy: Always readinessProbe:
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
新创建的pod上出现错误:
Warning Unhealthy 0s (x2 over 5s) kubelet, aks-agentpool-26902276-0 Readiness probe failed: HTTP probe failed with statuscode: 401
从日志中可以看出,新吊舱和两个吊舱都在运行
接收HTTP 401 for readiness调用的可能原因是什么?据我所知,这是Kubernetes内部的一个调用,不涉及身份验证。Pod是一个Spring引导应用程序
,不需要授权对spring/health端点的请求,并且在本地运行应用程序时,它可以正常工作。我可以从这个端点获得http 200响应
默认情况下,只有健康信息显示给未经授权的访问
通过HTTP
在我的例子中,问题不是添加SpringBootStarter执行器依赖项
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
我认为Spring Security需要允许在不进行身份验证的情况下访问您的健康端点编辑问题以添加更多详细信息我猜您可以找到答案。因此,在本地运行应用程序时,它工作不正常?