Duplicate rules created in GKE Ingress load balancer

8/10/2019

Every time I add a new rule to the ingress, it creates multiple rules in the load balancer. The rules are basically the same, pointing to the same backend

Here is my ingress file:

apiVersion: networking.gke.io/v1beta1
kind: ManagedCertificate
metadata:
  name: ingress-test.wpspeedmatters.com
spec:
  domains:
    - ingress-test.wpspeedmatters.com
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: basic-ingress
  annotations:
    kubernetes.io/ingress.global-static-ip-name: wordpress-ip
    networking.gke.io/managed-certificates: ingress-test.wpspeedmatters.com
spec:
  backend:
    serviceName: wordpress
    servicePort: 8080
  rules:
    - host: ingress-test.wpspeedmatters.com
      http:
        paths:
          - path: /*
            backend:
              serviceName: wordpress
              servicePort: 8080

Here are the duplicate rules created in the load balancer: enter image description here

-- Gijo Varghese
google-kubernetes-engine
kubernetes
kubernetes-ingress

1 Answer

8/14/2019

By default, the HTTP(S) Load Balancer will create two default rules: One that matches all the hosts and paths and another matching your current host ingress-test.wpspeedmatters.com and all paths.

Then, your custom path defined in the Ingress YAML (/*) will be added. In this case, it just happens that is the same as the second aforementioned rule, that makes it look as if they were repeated.

If you change it to /something instead of /*, you will still end up with 3 path rules. However, this time you'd have Host as ingress-test.wpspeedmatters.com and Path as /something, plus the other 2 default rules in the load balancer.

So it's basically the default load balancer rules plus your ingress custom rules.

-- yyyyahir
Source: StackOverflow