简体   繁体   中英

Is it possible to create a GKE Ingress without a default backend?

The Ingress documentation states that:

An Ingress with no rules sends all traffic to a single default backend. The default backend is typically a configuration option of the Ingress controller and is not specified in your Ingress resources.

If none of the hosts or paths match the HTTP request in the Ingress objects, the traffic is routed to your default backend.

All GKE Ingress objects I manage point to a specific backend like:

spec:
  rules:
    - host: my.host.com
      http:
        paths:
          - path: /*
            backend:
              serviceName: the service
              servicePort: 1337

Is there anyway to create these Ingress objects without the default backend? If so, what are the consequences of this?

Is there anyway to create these Ingress objects without the default backend? If so, what are the consequences of this?

Short answer is: No , you can't create Ingress without having the "default backend" as a last resort. The default backend is a part of default behaviour of kubernetes.

That behaviour is explained in this thread .

All the requests that have no matching backend in your Ingress definition will be forwarded to the "default backend" ("request - response" logic, no orphaned requests).

As we can see from: cluster/addons/cluster-loadbalancing/glbc/default-svc-controller.yaml

says that:

    # Any image is permissible as long as:
    # 1. It serves a 404 page at /
    # 2. It serves 200 on a /healthz endpoint
    image: k8s.gcr.io/ingress-gce-404-server-with-metrics-amd64:v1.6.0

That is why you can put your own custom image for the kube-system/l7-default-backend deployment.

You can find additional details in:

  • cluster/gce/manifests/glbc.manifest
  • cluster/addons/cluster-loadbalancing/glbc/default-svc.yaml

files.

Hope that info sheds some light on why there is a default backend and how it works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM