[英]Google Cloud not Applying the BackendConfig on the Load Balancer Health Check
I have a deployment.我有一个部署。 The pod container's have no readinessProbe(s), because the healtcheck will be configured using a BackendConfig.
pod 容器没有 readinessProbe(s),因为 healtcheck 将使用 BackendConfig 配置。
The service is as follows:服务如下:
---
apiVersion: v1
kind: Service
metadata:
name: my-app-service
namespace: my-namespace
annotations:
cloud.google.com/neg: '{"ingress": true}'
cloud.google.com/backend-config: '{"default": "my-app-backendconfig"}'
spec:
type: NodePort
externalTrafficPolicy: Local
ports:
- name: flower-nodeport-port
port: 80
targetPort: 5555
protocol: TCP
selector:
app: my-app
And this is the BackendConfig to create the health check:这是创建健康检查的 BackendConfig:
apiVersion: cloud.google.com/v1
kind: BackendConfig
metadata:
name: my-app-backendconfig
namespace: my-namespace
labels:
app: my-app
spec:
healthCheck:
checkIntervalSec: 20
timeoutSec: 1
healthyThreshold: 1
unhealthyThreshold: 5
type: TCP
The problem is that Google Cloud is not applying the healtcheck as I described it.问题是谷歌云没有像我描述的那样应用健康检查。 Check the screenshot below:
检查下面的屏幕截图:
As you can see, values like "Unhealthy threshold" and "Timeout" are not being taken into account.如您所见,没有考虑“不健康阈值”和“超时”等值。
What am I doing wrong?我究竟做错了什么?
If the Pod template for the Service's serving Pods does not have a container with a readiness probe whose attributes can be interpreted as health check parameters, the default values are used to create the health check.如果服务的服务 Pod 的 Pod 模板没有带有准备探测的容器,其属性可以解释为健康检查参数,则默认值用于创建健康检查。 Both the Anthos Ingress controller and the GKE Ingress controller can create a health check using only the default values.
Anthos Ingress controller 和 GKE Ingress controller 都可以仅使用默认值创建健康检查。
The ideal way to use the 'BackendConfig' is when the serving pods for your service contains multiple containers, if you're using the Anthos Ingress controller or if you need control over the port used for the load balancer's health checks, then you should use a BackendConfig CDR to define health check parameters.使用“BackendConfig”的理想方式是当您的服务的服务 pod 包含多个容器时,如果您使用的是 Anthos Ingress controller 或者如果您需要控制用于负载均衡器健康检查的端口,那么您应该使用用于定义健康检查参数的 BackendConfig CDR。 Refer to the health check for each backend service corresponding to a Kube.netes Service and Parameters from a readiness probe for more information.
有关更多信息,请参阅与Kube.netes 服务对应的每个后端服务的健康检查和来自就绪探针的参数。
Refer to the similar SO1 , SO2 for more information.有关详细信息,请参阅类似的SO1和SO2 。
Also go through the how health checks work for more information.也可以通过 go 了解健康检查的工作原理。
Finally refer to this How to troubleshoot unhealthy backends in Google Cloud Load Balancers may help to resolve your issue.最后参考这个How to troubleshoot unhealthy backends in Google Cloud Load Balancers可能有助于解决您的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.