1

我有一个 EKS 集群,其中aws-alb-ingress-controller控制指向 EKS 集群的 AWS ALB 的设置。

在对其中一个部署进行滚动更新后,应用程序失败,导致Pod永远无法启动(Pod 卡在 status 中CrashLoopBackOff)。但是,以前的版本Pod仍在运行。但似乎服务的状态仍然不健康:

在此处输入图像描述

这意味着现在所有流量都被重定向到默认后端,即不同的服务。在这种情况下,在 Kubernetes 中,部署的相关服务类型为NodePort

Type:                     NodePort
IP:                       172.20.186.130
Port:                     http-service  80/TCP
TargetPort:               5000/TCP
NodePort:                 http-service  31692/TCP
Endpoints:                10.0.3.55:5000

是什么导致端点变得不健康?我希望它只是将流量重定向到Pod仍在运行的旧版本。有什么办法可以确保端点保持健康?

4

1 回答 1

2

The problem was that while in Kubernetes the application was healthy, the ALB load-balancer performed it's own health check. This health check was configured by default to expect a 200 response from the / endpoint, however for this specific application it did not return a 200 response on that endpoint.

Since the ALB is controlled by the alb-ingress-controller, I added an annotation on my ingress to configure the correct path: alb.ingress.kubernetes.io/healthcheck-path: /health. Since we are working with Spring Microservices this endpoint works for all our applications.

于 2019-04-25T12:40:52.123 回答