Apache APISIX is a dynamic, real-time, high-performance API gateway based on OpenResty and Etcd. It has entered Apache for incubation. It provides rich traffic management functions, such as load balancing, dynamic routing, dynamic upstream, A/B testing, canary release, rate limiting, circuit breaking, defense against malicious attacks, authentication, monitoring indicators, service observability, service governance, etc. APISIX can be used to handle traditional north-south traffic and east-west traffic between services. Compared with traditional API gateways, APISIX has dynamic routing and hot loading plug-in functions, avoiding the reload operation after configuration. At the same time, APISIX supports more protocols such as HTTP(S), HTTP2, Dubbo, QUIC, MQTT, TCP/UDP, etc. It also has a built-in Dashboard, providing a powerful and flexible interface. It also provides rich plug-in support functions and allows users to customize plug-ins. The above picture is the architecture diagram of APISIX, which is generally divided into two parts: the data plane and the control plane. The control plane is used to manage routing, mainly through etcd to implement the configuration center. The data plane is used to process client requests, which is implemented by APISIX itself and will continuously watch the route, upstream and other data in etcd. APISIX IngressAs an API gateway, APISIX also supports being used as an Ingress controller for Kubernetes. The architecture of APISIX Ingress is divided into two parts. One part is APISIX Ingress Controller, which will complete configuration management and distribution as the control plane. The other part, APISIX (agent), is responsible for carrying business traffic. When the client initiates a request and it reaches Apache APISIX, it will directly transfer the corresponding business traffic to the backend (such as Service Pod) to complete the forwarding process. This process does not need to go through the Ingress Controller, which ensures that if there is a problem, or if changes, expansion or migration are made, it will not affect users and business traffic. At the same time, on the configuration side, users can create resources through kubectl apply and apply custom CRD configurations to the K8s cluster. The Ingress Controller will continue to watch these resource changes to apply the corresponding configurations to Apache APISIX (through the admin api). As can be seen from the above figure, APISIX Ingress uses a data plane and control plane separation architecture, so users can choose to deploy the data plane inside or outside the K8s cluster. However, Ingress Nginx puts the control plane and data plane in the same Pod. If there is a slight error in the Pod or the control plane, the entire Pod will crash, which will affect the business traffic. This architectural separation provides users with a more convenient deployment option, and also facilitates the migration and use of related data in the business architecture adjustment scenario. The core features currently supported by the APISIX Ingress controller include:
InstallWe use APISIX in the Kubernetes cluster here. We can install it through Helm Chart. First, add the official Helm Chart repository:
Since the APISIX Chart package contains the dependencies of the dashboard and ingress controller, we only need to enable it in values to install the ingress controller:
Create a new values file for installation in the apisix/ci directory, with the following content:
After testing, the official Helm Chart package does not support etcd multi-node clusters very well. I tested running 3 nodes and there was a problem. The template should be modified to be compatible. In addition, the compatibility with external etcd tls clusters is not good. For example, the dashboard Chart needs to modify the template to support tls. So here we test to change it to a 1-copy etcd cluster first. APISIX needs to rely on etcd. By default, Helm Chart will automatically install a 3-replica etcd cluster and provide a default StorageClass. If you already have a default storage class, you can ignore the following steps. Here we install an nfs provisioner. Use the following command to install a default StorageClass:
A StorageClass will be automatically created after the installation is complete:
Then directly execute the following command for one-click installation:
Normally, apisix can be deployed successfully:
testNow we can create a routing rule for the Dashboard by creating a new ApisixRoute resource object as shown below:
After creation, apisix-ingress-controller will map the above resource objects to the configuration in APISIX through the admin api:
So in fact, our access point is APISIX, and apisix-ingress-controller is just a tool for listening to crds and then translating crds into APISIX configuration. Now we can access our dashboard through the NodePort port of apisix-gateway: The default login username and password are both admin. After logging in, you can see the routing information of the dashboard we created above under the routing menu: Click View below to see the actual routing configuration information under APISIX: Therefore, if we want to use APISIX, we must also understand the concept of route. Route is the entry point of the request. It defines the matching rules between client requests and services. Routes can be associated with services and upstreams. A service can correspond to a group of routes, and a route can correspond to an upstream object (a group of backend service nodes). Therefore, each request that matches the route will be proxied by the gateway to the upstream service bound to the route. After understanding the routing, we naturally know that we also need an upstream Upstream to associate. This concept is basically the same as the Upstream in Nginx. Under the Upstream menu, you can see the upstream service corresponding to the dashboard we created above: In fact, it is to map the Endpoints in Kubernetes to the Upstream in APISIX, and then we can load it ourselves on the APISIX side. The Dashboard function provided by APISIX is very comprehensive. We can even make all configurations directly on the page, including plug-ins, which is very convenient. Of course, there are many other advanced features, such as traffic segmentation, request authentication, etc. These advanced features are more convenient to use in crds. Of course, they also support native Ingress resource objects. More advanced uses of APISIX will be explained later. |
<<: A detailed introduction to the difference between WiFi5 and WiFi6 network speeds
>>: 2021 China Internet Haha List 4: Top Ten Figures
Just as a manned spacecraft was sent into space, ...
UCloud (UCloud Technology Co., Ltd.) is also a fa...
In the digital age, how to use technology to prom...
In the early days of the web, people sent files t...
On November 16, the China (Shenzhen) Smart City S...
I haven't shared information about HostHatch ...
[[377418]] 1. Introduction CAN bus was developed ...
Network virtualization software allows companies ...
Multi-access edge computing (MEC) or previously m...
2023 is coming to an end. edgeNAT is offering a s...
edgeNAT has launched a new CDN product this month...
The optical module power is abnormal! What should...
ReliableSite has released some special Black Frid...
On June 2, according to the latest report release...
VMISS (Virtual Machines Innovative Solutions) was...