|
1 | 1 |
|
2 | 2 |
|
3 |
| - |
4 |
| - |
5 |
| - |
6 |
| - |
7 |
| - |
8 |
| - |
9 | 3 | ## nginx ingress
|
10 | 4 | ### nginx ingress redirect
|
11 | 5 | ```yaml
|
@@ -245,4 +239,39 @@ spec:
|
245 | 239 | name: example-service
|
246 | 240 | port:
|
247 | 241 | number: 80
|
248 |
| -``` |
| 242 | +``` |
| 243 | + |
| 244 | + |
| 245 | +## NGINX Ingress Controller pod |
| 246 | +![[Pasted image 20250805111001.png]] |
| 247 | + |
| 248 | + |
| 249 | +### 处理新的ingress资源 |
| 250 | + |
| 251 | +![[Pasted image 20250805111221.png]] |
| 252 | + |
| 253 | +1. _User_ creates a new Ingress resource. |
| 254 | + _用户_ 创建一个新的 Ingress 资源。 |
| 255 | +2. The NGINX Ingress Controller process has a _Cache_ of the resources in the cluster. The _Cache_ includes only the resources NGINX Ingress Controller is concerned with such as Ingresses. The _Cache_ stays in sync with the Kubernetes API by [watching for changes to the resources](https://kubernetes.io/docs/reference/using-api/api-concepts/#efficient-detection-of-changes). |
| 256 | + NGINX Ingress Controller 进程拥有集群资源的_缓存_ 。该_缓存_仅包含 NGINX Ingress Controller 关注的资源,例如 Ingress。该_缓存_通过[监视资源的变化](https://kubernetes.io/docs/reference/using-api/api-concepts/#efficient-detection-of-changes)与 Kubernetes API 保持同步。 |
| 257 | +3. Once the _Cache_ has the new Ingress resource, it notifies the _Control Loop_ about the changed resource. |
| 258 | + 一旦_缓存_有了新的入口资源,它就会通知_控制循环_有关更改的资源。 |
| 259 | +4. The _Control Loop_ gets the latest version of the Ingress resource from the _Cache_. Since the Ingress resource references other resources, such as TLS Secrets, the _Control loop_ gets the latest versions of those referenced resources as well. |
| 260 | + _控制循环_从 _Cache_ 获取 Ingress 资源的最新版本。由于 Ingress 资源引用了其他资源(例如 TLS Secrets),因此_控制循环_也会获取这些引用资源的最新版本。 |
| 261 | +5. The _Control Loop_ generates TLS certificates and keys from the TLS Secrets and writes them to the filesystem. |
| 262 | + _控制循环_ 从 TLS 机密生成 TLS 证书和密钥,并将它们写入文件系统。 |
| 263 | +6. The _Control Loop_ generates and writes the NGINX _configuration files_, which correspond to the Ingress resource, and writes them to the filesystem. |
| 264 | + _控制循环_ 生成并写入与 Ingress 资源对应的 NGINX _配置文件_ ,并将其写入文件系统。 |
| 265 | +7. The _Control Loop_ reloads _NGINX_ and waits for _NGINX_ to successfully reload. As part of the reload: |
| 266 | + _控制循环_ 重新加载 _NGINX_ ,并等待 _NGINX_ 成功重新加载。重新加载过程中: |
| 267 | + 1. _NGINX_ reads the _TLS certs and keys_. |
| 268 | + _NGINX_ 读取 _TLS 证书和密钥_ 。 |
| 269 | + 2. _NGINX_ reads the _configuration files_. |
| 270 | + _NGINX_ 读取_配置文件_ 。 |
| 271 | +8. The _Control Loop_ emits an event for the Ingress resource and updates its status. If the reload fails, the event includes the error message. |
| 272 | + _控制循环_ 会为 Ingress 资源发出事件并更新其状态。如果重新加载失败,该事件会包含错误消息。 |
| 273 | + |
| 274 | +### NGINX Ingress Controller 是一个 Kubernetes 控制器 |
| 275 | + |
| 276 | +NGINX Ingress Controller 持续处理集群中的新增资源和现有资源的变更。因此,NGINX 配置始终与集群中的资源保持同步更新。 |
| 277 | +NGINX Ingress Controller 是 [Kubernetes 控制器](https://kubernetes.io/docs/concepts/architecture/controller/)的一个示例:NGINX Ingress Controller 运行一个控制循环,确保 NGINX 根据所需状态(Ingress 和其他资源)进行配置。 |
0 commit comments