我正在使用具有以下配置的入口为 GKE 上的 consul ui 创建负载均衡器
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: public-apis
spec:
rules:
- host: consul.example.com
http:
paths:
- path: /ui/
pathType: Prefix
backend:
serviceName: hashicorp-consul-ui
servicePort: http
服务 hashicorp-consul-ui
是 clusterIP 类型的服务。
另外,我正在创建以下 backendConfig
apiVersion: cloud.google.com/v1
kind: BackendConfig
metadata:
name: consul-ui-backendconfig
spec:
healthCheck:
type: HTTP
requestPath: /v1/health/state/failed
port: 80
我将以下注释添加到 clusterIP 服务 hashicorp-consul-ui
'cloud.google.com/backend-config': '{"ports": {"80":"consul-ui-backendconfig"}}'
这个backendConfig为ingress创建的后端服务创建健康检查,这个端点返回200。但是健康检查失败,ingress处于Unhealthy状态
我已启用登录 healthCheck 并且我在 NEG 上获得以下登录
healthCheckProbeResult: {
detailedHealthState: "TIMEOUT"
healthCheckProtocol: "HTTP"
healthState: "UNHEALTHY"
ipAddress: "10.24.1.30"
previousDetailedHealthState: "UNKNOWN"
previousHealthState: "UNHEALTHY"
probeCompletionTimestamp: "2021-02-14T03:31:43.337063261Z"
probeRequest: "/v1/health/state/failed"
probeResultText: "HTTP response: , Error: Connection refused"
probeSourceIp: "35.191.9.211"
responseLatency: "0.001265s"
targetIp: "10.24.1.30"
targetPort: 80
}
另外,不知道为什么我只收到一次这个日志,我不应该定期收到这些日志吗?
另外,谁能指导我如何解决这个 healthCheck 问题?
答案 0 :(得分:-1)
Consul API/UI 默认侦听端口 8500,或在集群中启用 TLS 时侦听 8501 端口。
将您的入口 servicePort
更改为使用端口 8500。这应该可以解决连接问题。
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: public-apis
spec:
rules:
- host: consul.example.com
http:
paths:
- path: /ui/
pathType: Prefix
backend:
serviceName: hashicorp-consul-ui
servicePort: 8500