对 Kubernetes Ingress 资源的澄清

Clarifications on Kubernetes Ingress resource

我有以下与 Kubernetes 中的 Ingress 资源相关的问题

  1. 单个 Ingress 控制器(例如:NginxIngress Controller)是否可以映射到多个 Ingress 资源?
  2. 如果 Ingress 资源映射到单个命名空间,在多个 Ingress 资源的情况下如何请求路由?
  3. Ingress 资源是否映射到唯一的主机名?
  4. 入口控制器(例如:Nginx 入口控制器)是否绑定到命名空间或者它是集群级资源?
  1. 是的,有可能,你可以看这里:
  2. 考虑到入口资源是入口规则:

If you create an Ingress resource without any hosts defined in the rules, then any web traffic to the IP address of your Ingress controller can be matched without a name based virtual host being required.

For example, the following Ingress routes traffic requested for first.bar.com to service1, second.bar.com to service2, and any traffic to the IP address without a hostname defined in request (that is, without a request header being presented) to service3.

Name based virtual hosting

3.

An optional host. In this example, no host is specified, so the rule applies to all inbound HTTP traffic through the IP address specified. If a host is provided (for example, foo.bar.com), the rules apply to that host.

Ingress rules

4.

Parameters field has a scope and namespace field that can be used to reference a namespace-specific resource for configuration of an Ingress class. Scope field defaults to Cluster, meaning, the default is cluster-scoped resource. Setting Scope to Namespace and setting the Namespace field will reference a parameters resource in a specific namespace:

Namespace-scoped parameters avoid the need for a cluster-scoped CustomResourceDefinition for a parameters resource. This further avoids RBAC-related resources that would otherwise be required to grant permissions to cluster-scoped resources.

Namespace-scoped parameters