Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GKE Ingress with container-native load balancing does not detect health check (Invalid value for field 'resource.httpHealthCheck')

I am running a cluster on Google Kubernetes Engine and I am currently trying to switch from using an Ingress with external load balancing (and NodePort services) to an ingress with container-native load balancing (and ClusterIP services) following this documentation: Container native load balancing

To communicate with my services I am using the following ingress configuration that used to work just fine when using NodePort services instead of 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

Now following the documentation, instead of using a readinessProbe as a part of the container deployment as a health check I switched to using ClusterIP services in combination with BackendConfig instead. For each deployment I am using a service like this:

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

And a Backend config:

apiVersion: cloud.google.com/v1
kind: BackendConfig
metadata:
  name: auth-hc-config
spec:
  healthCheck:
    checkIntervalSec: 10
    port: 8083
    type: http
    requestPath: /auth/health

As a reference, this is what the readinessProbe used to look like before:

          readinessProbe:
            failureThreshold: 3
            httpGet:
              path: /auth/health
              port: 8083
              scheme: HTTP
            periodSeconds: 10

Now to the actual problem. I deploy the containers and services first and they seem to startup just fine. The ingress however does not seem to pick up the health checks properly and shows this in the Cloud console:

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

The cluster as well as the node pool are running GKE version 1.17.6-gke.11 so the annotation cloud.google.com/neg: '{"ingress": true}' is not necessary. I have checked and the service is annotated correctly:

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"]}

I have already tried to re-create the cluster and the node-pool with no effect. Any ideas on how to resolve this? Am I missing an additional health check somewhere? Cloud console

like image 306
BundyQ Avatar asked Jul 24 '20 07:07

BundyQ


People also ask

Do GKE clusters have HTTP load balancing enabled by default?

GKE clusters have HTTP load balancing enabled by default; you must not disable it. GKE Ingress resources come in two types: Ingress for external HTTP (S) load balancer deploys the Google Cloud external HTTP (S) load balancer .

How does the GKE ingress load balancing add-on work?

When you create an Ingress object, the GKE Ingress controller creates a Google Cloud HTTP (S) Load Balancer and configures it according to the information in the Ingress and its associated Services. To use Ingress, you must have the HTTP load balancing add-on enabled.

Does the GKE ingress controller support health checks?

Only the GKE Ingress controller supports inferring parameters from a readiness probe. 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.

How do I use GKE ingress?

To use Ingress, you must have the HTTP load balancing add-on enabled. GKE clusters have HTTP load balancing enabled by default; you must not disable it. GKE Ingress resources come in two types: Ingress for external HTTP (S) load balancer deploys the Google Cloud external HTTP (S) load balancer .


1 Answers

I found my issue. Apparently the BackendConfig's type attribute is case-sensitive. Once I changed it from http to HTTP it worked after I recreated the ingress.

like image 123
BundyQ Avatar answered Oct 12 '22 15:10

BundyQ