Module 02 · Kubernetes Basics
Ingress Objects vs. Ingress Controller入站对象与入站控制器
In Kubernetes, external access to cluster services is overseen by Ingress, consisting of two core components: the Ingress API object and the Ingress controller. Let's understand these elements and their collaborative functionality.
在 Kubernetes 中,集群服务的对外访问由入站(Ingress)管理,它由两个核心组件组成:入站 API 对象和入站控制器。让我们了解这些元素及其协同功能。
Ingress objects 入站对象
The Ingress acts as a supervisor for external access, exposing routes from outside the cluster to internal services, mainly focusing on HTTP and HTTPS traffic. It adheres to rules defined on the Ingress resource to regulate traffic routing.
入站(Ingress)充当外部访问的监管者,将集群外部的路由暴露到内部服务,主要关注 HTTP 和 HTTPS 流量。它遵循定义在入站资源上的规则来管理流量路由。
It doesn't manage arbitrary ports or protocols. Instead, it can provide services with externally accessible URLs, balance traffic, handle SSL/TLS termination, and enable name-based virtual hosting. For non-HTTP and non-HTTPS services, specific service types such as Service.Type=NodePort or Service.Type=LoadBalancer are typically used.
它不管理任意端口或协议。相反,它可以提供具有外部可访问 URL 的服务,平衡流量,处理 SSL/TLS 终止,并启用基于名称的虚拟主机。对于非 HTTP 和非 HTTPS 服务,通常使用特定服务类型,如 Service.Type=NodePort 或 Service.Type=LoadBalancer。
Ingress controllers 入口控制器
On the operational side, the Ingress controller is the deployed cluster resource responsible for implementing rules specified by the Ingress API object. Unlike certain controllers that automatically run as part of the kube-controller-manager binary, the Ingress controller requires explicit activation for the Ingress resource to function. Its primary role is to execute the directives outlined in the Ingress, commonly utilizing a load balancer or setting up additional frontends to handle incoming traffic.
在操作方面,入口控制器是部署的集群资源,负责实现由入口 API 对象指定的规则。与某些作为 kube-controller-manager 二进制文件一部分自动运行的控制器不同,入口控制器需要显式激活入口资源才能运行。其主要角色是执行入口中概述的指令,通常利用负载均衡器或设置额外的前端来处理传入流量。
Ingress objects vs Ingress controllers 入口对象与入口控制器
| Feature 功能 | Ingress Objects 入站对象 | Ingress Controllers 入站控制器 |
|---|---|---|
| Definition 定义 | API object managing external access to services 管理服务外部访问的 API 对象 |
Cluster resource implementing rules specified by Ingress 实现入站规则指定的集群资源 |
| Primary Function 主要功能 | Regulates external access routing 调节外部访问路由 |
Implements rules, fulfilling the Ingress 实现规则,满足 Ingress |
| Configuration Source 配置源 | Rules defined on the Ingress resource 在 Ingress 资源上定义的规则 |
Reads and processes information from the Ingress object 读取并处理来自 Ingress 对象的信息 |
| Traffic Handling 流量处理 | Manages HTTP and HTTPS routes 管理 HTTP 和 HTTPS 路由 |
Utilizes load balancer, configures frontends for traffic 使用负载均衡器,配置前端以处理流量 |
| Activation 激活 | Active upon configuration with Ingress resource 通过 Ingress 资源配置后激活 |
Must be explicitly running for Ingress to function 必须明确运行才能使 Ingress 功能正常 |
| Handling Protocols 处理协议 | Focused on HTTP and HTTPS 专注于 HTTP 和 HTTPS |
Implements rules for various protocols and ports 实现各种协议和端口的规则 |
| Automatic Startup 自动启动 | Activated with configuration 配置激活 |
Requires explicit activation in the cluster 需要在集群中显式激活 |
| Analogy 类比 | Traffic rule set for the cluster 集群交通规则集 |
Executor, similar to Nginx instance handling rules 执行者,类似于 Nginx 实例处理规则 |
Conclusion 结论
In Kubernetes, overseeing external access includes Ingress, which consists of Ingress objects and Ingress controllers. Ingress manages the routing of HTTP and HTTPS traffic, and Ingress controllers implement these rules in the cluster. Understanding this interplay is essential for effective external access management in Kubernetes.
在 Kubernetes 中,管理外部访问包括 Ingress,它由 Ingress 对象和 Ingress 控制器组成。Ingress 管理 HTTP 和 HTTPS 流量的路由,而 Ingress 控制器在集群中实现这些规则。理解这种相互作用对于在 Kubernetes 中有效管理外部访问至关重要。