You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by sy...@apache.org on 2023/10/25 01:17:33 UTC
[apisix-website] branch master updated: docs: add ingress-apisix.md (#1713)
This is an automated email from the ASF dual-hosted git repository.
sylviasu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-website.git
The following commit(s) were added to refs/heads/master by this push:
new 6d9f4131bb8 docs: add ingress-apisix.md (#1713)
6d9f4131bb8 is described below
commit 6d9f4131bb86652d3e271235bc670fca89db533f
Author: Yilia <11...@users.noreply.github.com>
AuthorDate: Wed Oct 25 09:17:28 2023 +0800
docs: add ingress-apisix.md (#1713)
* docs: add ingress-apisix.md
* Update ingress-apisix.md
---
blog/en/blog/2023/10/18/ingress-apisix.md | 212 ++++++++++++++++++++++++++++++
blog/zh/blog/2023/10/18/ingress-apisix.md | 44 ++++---
2 files changed, 236 insertions(+), 20 deletions(-)
diff --git a/blog/en/blog/2023/10/18/ingress-apisix.md b/blog/en/blog/2023/10/18/ingress-apisix.md
new file mode 100644
index 00000000000..c9a33a7e2b9
--- /dev/null
+++ b/blog/en/blog/2023/10/18/ingress-apisix.md
@@ -0,0 +1,212 @@
+---
+title: "Embrace the Lightweight APISIX Ingress Controller Without etcd Dependency"
+authors:
+ - name: "Xin Rong"
+ title: "Author"
+ url: "https://github.com/AlinsRan"
+ image_url: "https://github.com/AlinsRan.png"
+ - name: "Yilia Lin"
+ title: "Technical Writer"
+ url: "https://github.com/Yilialinn"
+ image_url: "https://avatars.githubusercontent.com/u/114121331?v=4"
+keywords:
+- Apache APISIX
+- APISIX Ingress Controller
+- etcd
+description: The innovative architecture of the APISIX Ingress Controller eliminates the dependency on a standalone etcd cluster, greatly simplifying maintenance costs and system complexity.
+tags: [Community]
+image: https://static.apiseven.com/2022/10/19/634f6677742a1.png
+---
+
+> The innovative architecture of the APISIX Ingress Controller eliminates the dependency on a standalone etcd cluster, greatly simplifying maintenance costs and system complexity.
+<!--truncate-->
+
+## Background
+
+APISIX Ingress Controller is a Kubernetes Ingress Controller based on Apache APISIX. It has the capability to convert Ingress/CRDs resources from Kubernetes into routing rules for Apache APISIX, synchronizing them with the Apache APISIX cluster. As a result, users can harness the robust functionalities of Apache APISIX, including plugins, load balancing, health checks, and more, for the management of inbound traffic in Kubernetes.
+
+
+
+
+
+In previous versions, deploying an APISIX Ingress Controller cluster necessitated the additional maintenance of a highly available etcd cluster. In practice, it proved to be less user-friendly and posed several challenges:
+
+1. **High Maintenance Costs for the etcd Cluster**: Setting up a highly available cluster involves significant learning and maintenance costs, including system resource consumption like memory. Deploying an etcd cluster in Kubernetes requires careful attention to various factors, often leading to challenges for those unfamiliar with etcd, and necessitating concerns about memory and other system resource consumption.
+
+2. **High Utilization Costs**: Deploying an APISIX Ingress Controller cluster entails three components. Compared to a single-component ingress-nginx, the APISIX Ingress Controller demands higher learning and debugging costs. It is notably less straightforward to use, presenting an additional burden for first-time users.
+
+3. **Data Redundancy and Inconsistency**: Both Kubernetes etcd and APISIX etcd clusters retain a copy of the data. During usage, efforts are often needed to prevent discrepancies between the two datasets. Due to APISIX and the Ingress controller being decoupled, addressing and mitigating such situations becomes challenging.
+
+4. **Obstacles in Implementing Gateway API**: The Gateway API dynamically manages the full lifecycle of a set of Gateways (APISIX). Because APISIX configuration primarily stems from etcd, the Ingress Controller must simultaneously monitor the etcd clusters and APISIX, which makes maintenance and management very complicated.
+
+In the overall architecture, Apache APISIX does not rely on the Ingress Controller. The Ingress Controller performs the role of pushing configuration but lacks the ability to manage APISIX effectively. These issues are challenging to address within the existing architecture. **To tackle these challenges and provide solutions, a new APISIX Ingress Controller architecture needs to be designed.**
+
+## Design of New Architecture
+
+To address the issues in the existing architecture, it is necessary to remove the etcd component. Currently, we are considering two main approaches:
+
+1. **Rendering the `apisix.yaml` configuration file**: Generate `apisix.yaml` configuration files based on the CRD. APISIX, in YAML deployment mode, periodically reads the entire `apisix.yaml` configuration file every second.
+
+2. **Simulating the etcd server API**: Building a KV in-memory database based on the CRD and simulating the etcd server API for use by APISIX. APISIX will attempt to watch the resource configurations provided by the Controller and notify all APISIX instances.
+
+Clearly, the first approach is simpler, but it is not suitable for scenarios where the gateway directly connects to backend Pods. The reason is that in Kubernetes, Pod IPs have dynamic scalability features, and the Ingress Controller generates the `apisix.yaml` configuration continuously.
+
+This causes the APISIX routing tree to be rebuilt frequently, causing long-term performance jitter. Finally, after discussion, the APISIX community decided to adopt the second option. Its architecture is shown in the figure below:
+
+
+
+
+
+APISIX Ingress Controller implements a new architecture in Release v1.7.0, which has the following advantages:
+
+- **Sole reliance on declarative configuration**: APISIX will exclusively rely on the configuration information provided by the Control Plane and take it as the sole source. This approach, commonly used in Kubernetes, greatly reduces operational complexity.
+
+- **No need to maintain a separate etcd cluster**: The new architecture eliminates the dependency on a standalone etcd cluster. This significantly reduces maintenance costs and complexity for users, making it easier to deploy and use.
+
+- **Advancement of the Kubernetes Gateway API standard**: APISIX relies on the Ingress Controller and enables it to manage the lifecycle of the gateway. This contributes to the complete implementation of the Gateway API.
+
+## Ideal Architecture for Gateway API
+
+Gateway API is the next-generation version of the Ingress API, offering enhanced functionality and expressiveness. Currently, Gateway API has gained support from numerous vendors and projects. As one of the implementers of Gateway API, APISIX Ingress Controller not only adheres to the standard specifications of Gateway API but also combines the rich features of Apache APISIX to provide users with a broader range of gateway configurations and policy options.
+
+The implementation of the new architecture further advances the realization of Gateway API, enabling better routing configuration and policies while reducing maintenance costs. This makes it easier to deploy and use, while also leveraging the advantages of Gateway API to improve the management efficiency of the API gateway.
+
+
+
+## How to Deploy and Use the New APISIX Ingress Controller
+
+In this chapter, we will explain the high-available installation and deployment of APISIX Ingress Controller in Kubernetes, and demonstrate how to configure `ApisixRoute` to access the `httpbin` application service in an example.
+
+### Install APISIX Ingress Controller
+
+1. You can run the following command to clone the APISIX source code from Github:
+
+```shell
+git clone --depth 1 --branch 1.7.0 https://github.com/apache/apisix-ingress-controller.git ingress-apisix-1.7.0
+
+cd ingress-apisix-1.7.0
+```
+
+2. Install CRDs
+
+```shell
+kubectl apply -k samples/deploy/crd/v1/
+```
+
+3. Install APISIX Ingress Controller
+
+```shell
+kubectl apply -f samples/deploy/composite.yaml
+```
+
+4. Check deployment status
+
+- Check service
+
+ ```shell
+ kubectl get service -n ingress-apisix # check service
+ ```
+
+ ```shell
+ NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
+ ingress-apisix-gateway NodePort 10.99.236.58 <none> 80:31143/TCP,443:30166/TCP 90s
+ ```
+
+- Check pods
+
+ ```shell
+ kubectl get pods -n ingress-apisix # check pod
+ ```
+
+ ```shell
+ NAME READY STATUS RESTARTS AGE
+ ingress-apisix-composite-deployment-5df9bc99c7-xxpvq 2/2 Running 0 100s
+ ```
+
+### Highly Available Deployment
+
+- Deploy 3 instances and you can achieve high availability by configuring [replicas](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/).
+
+```shell
+ kubectl scale deployment ingress-apisix-composite-deployment --replicas=3 -n ingress
+-apisix
+```
+
+- Check deployment status
+
+```shell
+kubectl get pods -n ingress-apisix
+```
+
+```shell
+
+NAME READY STATUS RESTARTS AGE
+ingress-apisix-composite-deployment-6bfdc5d6f6-gjgql 2/2 Running 0 20s
+ingress-apisix-composite-deployment-6bfdc5d6f6-jb24q 2/2 Running 0 20s
+ingress-apisix-composite-deployment-6bfdc5d6f6-sjpzr 2/2 Running 0 45h
+```
+
+### Example of Usage
+
+> ApisixRoute is the CRDs resource of Ingress, used to represent routing traffic to specific backend services.
+
+The following example shows how to configure `ApisixRoute` to route traffic to the `httpbin` backend service.
+
+#### Deploy httpbin Application Service
+
+- Deploy `httpbin` application service and configure `ApisixRoute`:
+
+```shell
+kubectl apply -f samples/httpbin/httpbin-route.yaml
+```
+
+- The specific `ApisixRoute` configuration is as follows:
+
+ All requests with `Host: httpbin.org` will be routed to the `httpbin` service
+
+ ```YAML
+ apiVersion: apisix.apache.org/v2
+ kind: ApisixRoute
+ metadata:
+ name: httpbin-route
+ spec:
+ http:
+ - name: route-1
+ match:
+ hosts:
+ - httpbin.org
+ paths:
+ - /*
+ backends:
+ - serviceName: httpbin
+ servicePort: 80
+ ```
+
+#### Visit httpbin Test
+
+Access the `ingress-apisix-gateway` service through local port forwarding, and requests will be routed from ingress-apisix-gateway to the httpbin application.
+
+```Bash
+# forward port 9080 -> service 80
+kubectl port-forward service/ingress-apisix-gateway 9080:80 -n ingress-apisix &
+
+# acesss httpbin
+curl http://127.0.0.1:9080/headers -H 'Host: httpbin.org'
+```
+
+```Bash
+{
+ "headers": {
+ "Accept": "*/*",
+ "Host": "httpbin.org",
+ "User-Agent": "curl/7.74.0",
+ "X-Forwarded-Host": "httpbin.org"
+ }
+}
+```
+
+## Summary
+
+We thoroughly discussed the innovative architecture of the APISIX Ingress Controller, liberating it from dependency on the etcd cluster. This greatly simplifies maintenance costs and system complexity. Simultaneously, the APISIX Ingress Controller actively advances the implementation of the Kubernetes Gateway API standard within the Ingress Controller, aiming to provide more extensive and consistent traffic management capabilities.
+
+In conclusion, whether it be the new architecture of APISIX Ingress Controller or the implementation of the Kubernetes Gateway API, the goal is to offer users a more robust, flexible, and user-friendly Ingress Controller solution to meet the ever-changing demands of cloud-native application deployment and traffic management.
diff --git a/blog/zh/blog/2023/10/18/ingress-apisix.md b/blog/zh/blog/2023/10/18/ingress-apisix.md
index 70056a1e2d9..cf01d0f6db3 100644
--- a/blog/zh/blog/2023/10/18/ingress-apisix.md
+++ b/blog/zh/blog/2023/10/18/ingress-apisix.md
@@ -1,41 +1,45 @@
---
-title: "Ingress APISIX:一种无需 etcd 的轻量级部署方式"
+title: "APISIX Ingress Controller:一种无需 etcd 的轻量级部署方式"
authors:
- name: "容鑫"
title: "Author"
url: "https://github.com/AlinsRan"
image_url: "https://github.com/AlinsRan.png"
+ - name: "Yilia Lin"
+ title: "Technical Writer"
+ url: "https://github.com/Yilialinn"
+ image_url: "https://avatars.githubusercontent.com/u/114121331?v=4"
keywords:
- Apache APISIX
-- Ingress APISIX
+- APISIX Ingress Controller
- etcd
-description: Ingress APISIX 创新架构,摆脱对 etcd 集群的依赖,极大简化维护成本和系统复杂性。
+description: APISIX Ingress Controller 创新架构,摆脱对 etcd 集群的依赖,极大简化维护成本和系统复杂性。
tags: [Community]
image: https://static.apiseven.com/2022/10/19/634f6677742a1.png
---
-> Ingress APISIX 创新架构,摆脱对 etcd 集群的依赖,极大简化维护成本和系统复杂性。
+> APISIX Ingress Controller 创新架构,摆脱对 etcd 集群的依赖,极大简化维护成本和系统复杂性。
<!--truncate-->
## 背景
-Ingress APISIX 是一个基于 Apache APISIX 的 Kubernetes Ingress Controller,它可以将 Kubernetes 中的 Ingress/CRDs 资源转换为 Apache APISIX 的路由规则,并同步到 Apache APISIX 集群中。由此一来,用户可以利用 Apache APISIX 的强大功能,如插件、负载均衡、健康检查等,来管理 Kubernetes 的入口流量。
+APISIX Ingress Controller 是一个基于 Apache APISIX 的 Kubernetes Ingress Controller,它可以将 Kubernetes 中的 Ingress/CRDs 资源转换为 Apache APISIX 的路由规则,并同步到 Apache APISIX 集群中。由此一来,用户可以利用 Apache APISIX 的强大功能,如插件、负载均衡、健康检查等,来管理 Kubernetes 的入口流量。
-
+
-
+
-在之前的版本中,部署 Ingress APISIX 集群需要额外维护一套高可用的 etcd 集群。实际上在使用过程中,它并不是那么好用,会带来了一些问题:
+在之前的版本中,部署 APISIX Ingress Controller 集群需要额外维护一套高可用的 etcd 集群。实际上在使用过程中,它并不是那么好用,会带来了一些问题:
- **etcd 集群维护成本高**:部署高可用集群需要较高的学习与维护成本,需要考虑内存等系统资源的消耗。在 Kubernetes 中部署 etcd 集群需要注意的事项较多,往往由于不熟悉 etcd 而无法有效解决问题。还需关心内存等系统资源消耗。
-- **使用成本高**:Ingress APISIX 集群的部署需要三个组件,相比于单个组件的 ingress-nginx 而言,当前架构需要较高的学习和调试成本,十分不易于使用,给初次使用者带来额外的负担。
+- **使用成本高**:APISIX Ingress Controller 集群的部署需要三个组件,相比于单个组件的 ingress-nginx 而言,当前架构需要较高的学习和调试成本,十分不易于使用,给初次使用者带来额外的负担。
- **数据冗余和一致性问题**:即 Kubernetes etcd 保留一份,APISIX ETCD 集群也保留了一份。在使用过程中,往往需要避免两者数据不一致的情况,但由于 APISIX 并不依赖于 Ingress controller,它们之间处于解耦的关系,很难处理和避免这种情况。
- **实现 Gatewa API 遇到阻碍**:Gateway API 能够动态的管理一组 Gateway(APISIX) 的生命周期,APISIX 配置主要来源于 etcd,Ingress Controlle 需要同时感知一组 etcd 集群与 APISIX 的状态,这使得维护和管理都会十分复杂。
-可以看到,在整个架构中,Apache APISIX 并不依赖于 Ingress Controller,后者只承担着配置推送的角色,实际上它并不具备管理 APISIX 的能力,这些问题在现有的架构中难以解决。**为了这些解决问题,我们需要设计新的 Ingress APISIX 架构。**
+可以看到,在整个架构中,Apache APISIX 并不依赖于 Ingress Controller,后者只承担着配置推送的角色,实际上它并不具备管理 APISIX 的能力,这些问题在现有的架构中难以解决。**为了这些解决问题,我们需要设计新的 APISIX Ingress Controller 架构。**
## 新架构的设计
@@ -43,15 +47,15 @@ Ingress APISIX 是一个基于 Apache APISIX 的 Kubernetes Ingress Controller
1. **渲染 `apisix.yaml` 配置文件**:根据 CRD 生成 `apisix.yaml` 配置文件,APISIX 在 yaml 部署模式下定期每秒钟全量读取 `apisix.yaml` 配置文件。
-2. **模拟 etcd server API**:根据 CRD 构建 KV 内存数据库,并模拟 etcd server API 提供给 APISIX 进行使用。APISIX 将会尝试 watch Controller 提供的资源配置。可以将会通知到所有 APISIX 实例。
+2. **模拟 etcd server API**:根据 CRD 构建 KV 内存数据库,并模拟 etcd server API 提供给 APISIX 进行使用。APISIX 将会尝试 watch Controller 提供的资源配置,并通知到 APISIX 实例。
显然,第一种方式会简单很多,但并不适用于网关直连后端 Pod 的场景,因为 Pod IP 在 Kubernetes 中具有动态伸缩的特性,Ingress Controller 会不断的生成 `apisix.yaml` 配置,这会导致 APISIX 路由树被频繁重建,从而造成长期的性能抖动。最终经社区讨论决定采用第二种方案,它的架构如下图所示:
-
+
-
+
-Ingress APISIX 在 Release v1.7.0 版本中实现了新架构,它相比具有以下优势:
+APISIX Ingress Controller 在 Release v1.7.0 版本中实现了新架构,它相比具有以下优势:
- **以声明式配置作为配置的唯一来源**:APISIX 将只会地依赖于 Control Plane 提供的配置信息并作为唯一来源,这是 Kubernetes 常见的方式,极大减少了运维复杂性。
@@ -61,7 +65,7 @@ Ingress APISIX 在 Release v1.7.0 版本中实现了新架构,它相比具有
### Gateway API 理想中的新架构
-Gateway API 是 Ingress API 的下一代版本,提供了更丰富的功能和表达能力。目前 Gateway API 已得到了众多厂商和项目的支持,Ingress APISIX 作为 Gateway API 的实现者之一,既遵循了 Gateway API 的标准规范,又结合了 Apache APISIX 的丰富特性,为用户提供了更多的网关配置和策略选项。
+Gateway API 是 Ingress API 的下一代版本,提供了更丰富的功能和表达能力。目前 Gateway API 已得到了众多厂商和项目的支持,APISIX Ingress Controller 作为 Gateway API 的实现者之一,既遵循了 Gateway API 的标准规范,又结合了 Apache APISIX 的丰富特性,为用户提供了更多的网关配置和策略选项。
新架构的落地能够进一步推进了 Gateway API 的实现,以提供更好的路由配置和策略,并降低维护成本,使其更易部署与使用,同时也可以充分利用 Gateway API 的优势,提高 API 网关的管理效率。
@@ -69,9 +73,9 @@ Gateway API 是 Ingress API 的下一代版本,提供了更丰富的功能和
## 新架构部署与使用
-在本章节中,将会说明在 Kubernetes 中高可用安装和部署 Ingress APISIX,并在例子中演示如何配置 `ApisixRoute` 以访问 `httpbin` 应用服务。
+在本章节中,将会说明在 Kubernetes 中高可用安装和部署 APISIX Ingress Controller,并在例子中演示如何配置 `ApisixRoute` 以访问 `httpbin` 应用服务。
-### 安装 Ingress APISIX
+### 安装 APISIX Ingress Controller
1. 你可以运行以下命令,从 Github 克隆 APISIX 源码:
@@ -87,7 +91,7 @@ cd ingress-apisix-1.7.0
kubectl apply -k samples/deploy/crd/v1/
```
-3. 安装 Ingress APISIX
+3. 安装 APISIX Ingress Controller
```shell
kubectl apply -f samples/deploy/composite.yaml
@@ -201,6 +205,6 @@ curl http://127.0.0.1:9080/headers -H 'Host: httpbin.org'
## 总结
-本文详细探讨了 Ingress APISIX 的创新架构,它摆脱了对 etcd 集群的依赖,极大地简化了维护成本和系统复杂性。同时,Ingress APISIX 也在积极推进 Kubernetes Gateway API 标准在 Ingress Controller 中的落地实现,以提供更丰富和一致的流量管理能力。
+本文详细探讨了 APISIX Ingress Controller 的创新架构,它摆脱了对 etcd 集群的依赖,极大地简化了维护成本和系统复杂性。同时,APISIX Ingress Controller 也在积极推进 Kubernetes Gateway API 标准在 Ingress Controller 中的落地实现,以提供更丰富和一致的流量管理能力。
-总而言之,无论是 Ingress APISIX 的新架构还是 Kubernetes Gateway API 实现的落地,旨在为用户提供更加强大、灵活和易用的 Ingress Controller 解决方案,以满足不断变化的云原生应用程序部署和流量管理需求。
+总而言之,无论是 APISIX Ingress Controller 的新架构还是 Kubernetes Gateway API 实现的落地,旨在为用户提供更加强大、灵活和易用的 Ingress Controller 解决方案,以满足不断变化的云原生应用程序部署和流量管理需求。