是否可以在没有默认后端的情况下创建 GKE Ingress?
Is it possible to create a GKE Ingress without a default backend?
Ingress documentation 指出:
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.
我管理的所有 GKE Ingress 对象都指向特定的后端,例如:
spec:
rules:
- host: my.host.com
http:
paths:
- path: /*
backend:
serviceName: the service
servicePort: 1337
有没有办法在没有默认后端的情况下创建这些 Ingress 对象?
如果是这样,这样做的后果是什么?
Is there anyway to create these Ingress objects without the default backend? If so, what are the consequences of this?
简短的回答是:否,如果没有 "default backend" 作为最后的手段,您将无法创建 Ingress。默认后端是 kubernetes 默认行为的一部分。
此 中解释了该行为。
所有在您的 Ingress 定义中没有匹配后端的请求将被转发到 "default backend"("request - response" 逻辑,没有孤立的请求)。
从中可以看出:cluster/addons/cluster-loadbalancing/glbc/default-svc-controller.yaml
说:
# 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
这就是为什么您可以为 kube-system/l7-default-backend
部署放置自己的自定义映像。
您可以在以下位置找到更多详细信息:
- cluster/gce/manifests/glbc.清单
- cluster/addons/cluster-loadbalancing/glbc/default-svc.yaml
个文件。
希望这些信息能够阐明为什么会有 default backend
以及它是如何工作的。
Ingress documentation 指出:
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.
我管理的所有 GKE Ingress 对象都指向特定的后端,例如:
spec:
rules:
- host: my.host.com
http:
paths:
- path: /*
backend:
serviceName: the service
servicePort: 1337
有没有办法在没有默认后端的情况下创建这些 Ingress 对象? 如果是这样,这样做的后果是什么?
Is there anyway to create these Ingress objects without the default backend? If so, what are the consequences of this?
简短的回答是:否,如果没有 "default backend" 作为最后的手段,您将无法创建 Ingress。默认后端是 kubernetes 默认行为的一部分。
此
所有在您的 Ingress 定义中没有匹配后端的请求将被转发到 "default backend"("request - response" 逻辑,没有孤立的请求)。
从中可以看出:cluster/addons/cluster-loadbalancing/glbc/default-svc-controller.yaml
说:
# 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
这就是为什么您可以为 kube-system/l7-default-backend
部署放置自己的自定义映像。
您可以在以下位置找到更多详细信息:
- cluster/gce/manifests/glbc.清单
- cluster/addons/cluster-loadbalancing/glbc/default-svc.yaml
个文件。
希望这些信息能够阐明为什么会有 default backend
以及它是如何工作的。