gpt4 book ai didi

kubernetes - 具有容器原生负载平衡的 GKE Ingress 未检测到运行状况检查(字段 'resource.httpHealthCheck' 的值无效)

转载 作者:行者123 更新时间:2023-12-02 11:30:02 24 4
gpt4 key购买 nike

我正在 Google Kubernetes Engine 上运行一个集群,我目前正在尝试按照以下文档从使用具有外部负载平衡(和 NodePort 服务)的 Ingress 切换到具有容器原生负载平衡(和 ClusterIP 服务)的 Ingress:Container native load balancing
为了与我的服务进行通信,我使用了以下入口配置,在使用 NodePort 服务而不是 ClusterIP 时,这些配置过去可以正常工作:

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: mw-ingress
annotations:
kubernetes.io/ingress.global-static-ip-name: mw-cluster-ip
networking.gke.io/managed-certificates: mw-certificate
kubernetes.io/ingress.allow-http: "false"
spec:
rules:
- http:
paths:
- path: /*
backend:
serviceName: billing-frontend-service
servicePort: 80
- path: /auth/api/*
backend:
serviceName: auth-service
servicePort: 8083
现在按照文档,我没有使用 readinessProbe 作为容器部署的一部分作为健康检查,而是转而使用 ClusterIP 服务与 BackendConfig 结合使用。对于每个部署,我都使用这样的服务:
apiVersion: v1
kind: Service
metadata:
labels:
app: auth
name: auth-service
namespace: default
annotations:
cloud.google.com/backend-config: '{"default": "auth-hc-config"}'
spec:
type: ClusterIP
selector:
app: auth
ports:
- port: 8083
protocol: TCP
targetPort: 8083
和后端配置:
apiVersion: cloud.google.com/v1
kind: BackendConfig
metadata:
name: auth-hc-config
spec:
healthCheck:
checkIntervalSec: 10
port: 8083
type: http
requestPath: /auth/health
作为引用,这就是 readinessProbe 以前的样子:
          readinessProbe:
failureThreshold: 3
httpGet:
path: /auth/health
port: 8083
scheme: HTTP
periodSeconds: 10
现在到实际问题。我首先部署容器和服务,它们似乎启动得很好。然而,入口似乎没有正确进行健康检查,并在云控制台中显示:
Error during sync: error running backend syncing routine: error ensuring health check: googleapi: Error 400: Invalid value for field 'resource.httpHealthCheck': ''. HTTP healthCheck missing., invalid
集群和节点池都运行 GKE 版本 1.17.6-gke.11,所以注释 cloud.google.com/neg: '{"ingress": true}'没有必要。我已检查并正确注释了该服务:
Annotations:       cloud.google.com/backend-config: {"default": "auth-hc-config"}
cloud.google.com/neg: {"ingress":true}
cloud.google.com/neg-status: {"network_endpoint_groups":{"8083":"k8s1-2078beeb-default-auth-service-8083-16a14039"},"zones":["europe-west3-b"]}

我已经尝试重新创建集群和节点池,但没有任何效果。关于如何解决这个问题的任何想法?我是否在某处错过了额外的健康检查?
Cloud console

最佳答案

我发现了我的问题。显然 BackendConfig 的 type属性区分大小写。一旦我从 http 更改它至 HTTP在我重新创建入口后它起作用了。

关于kubernetes - 具有容器原生负载平衡的 GKE Ingress 未检测到运行状况检查(字段 'resource.httpHealthCheck' 的值无效),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63069146/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com