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

标签 kubernetes google-cloud-platform google-compute-engine google-kubernetes-engine kubernetes-ingress

我正在 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/

相关文章:

security - Kubernetes - 动态命名空间/安全

shell - 谷歌计算引擎 : SSH-Error while trying to connect to an instance

node.js - 如何防止 Google Cloud VM 实例对 Firebase 数据库中的一个事件进行多次 react ?

google-app-engine - 如何在本地将 GAE 应用程序和 GCE 应用程序连接到同一数据存储区?

node.js - Compute Engine Express 两个端口

java - 如何使用 Kubernetes 客户端列出存储类别

azure - Azure 上的 Aks Creation 需要很长时间才能收到以下错误消息

kubernetes - 在kubernetes中的http liveness和readiness探针中传递url查询参数

Kubernetes 自动缩放器 objective-c PUUtilizationPercentage

google-cloud-platform - 为 Compute Engine 虚拟机设置环境变量