NGINX Ingress Controller
Introduction
Kubernetes uses kube-proxy to expose Services and provide load balancing, at the transport layer. In real-world Internet applications, traffic management requires not only basic forwarding but also granular policy enforcement. Using load balancers enhances both operational flexibility and forwarding performance.
This is where Ingresses enter. Ingresses provide application-layer forwarding functions, such as virtual hosts, load balancing, SSL proxy, and HTTP routing, for Services that can be directly accessed outside a cluster.
Kubernetes has officially released the Nginx-based Ingress Controller. CCE's NGINX Ingress Controller uses templates and images from the community. This add-on generates Nginx configuration and stores the configuration using ConfigMaps. The configuration will be written to Nginx pods through the Kubernetes API. In this way, the Nginx configuration is modified and updated. For details, see How an Nginx Ingress Works.
You can visit the open-source community for more information.
- When installing NGINX Ingress Controller, you can specify Nginx parameters. These parameters take effect globally and are contained in the nginx.conf file. You can search for the parameters in ConfigMaps. If the parameters are not included in ConfigMaps, the configurations will not take effect.
- After the add-on is installed, you can interconnect the ingress you create on the CCE console with Nginx and set Nginx ingress functions through annotations. For details about the supported annotations, see Annotations.
- Do not manually modify or delete the load balancer and listener that are automatically created by CCE. Otherwise, the workload will be abnormal. If you have modified or deleted them by mistake, uninstall NGINX Ingress Controller and reinstall it.
How an Nginx Ingress Works
An Nginx ingress consists of the ingress object, Ingress Controller, and Nginx. Ingress Controller assembles the ingress into the Nginx configuration file (nginx.conf) and reloads Nginx to make the configuration changes apply. When Ingress Controller detects that a pod in a Service changes, it dynamically changes the upstream server group configuration of Nginx. In this case, the Nginx process does not need to be reloaded. Figure 1 shows how an Nginx ingress works.
- An ingress is a group of access rules that forward requests to the specified Services based on domain names or URLs. Ingresses are stored in etcd and can be added, deleted, modified, and queried through APIs.
- Ingress Controller monitors the changes of resource objects such as ingresses, Services, endpoints, secrets (mainly TLS certificates and keys), nodes, and ConfigMaps in real time and automatically performs operations on Nginx.
- Nginx implements load balancing and access control at the application layer.
Constraints
- Dedicated load balancers with private IP addresses bound and used for network load balancing (load balancing over TCP or UDP) should be selected.
- During the upgrade of NGINX Ingress Controller, 10s is reserved for deleting NGINX Ingress Controller deployed on the backend servers associated with a load balancer.
- The timeout duration for the graceful exit of NGINX Ingress Controller is 300s. If the timeout duration is longer than 300s during the upgrade of the NGINX Ingress Controller, persistent connections will be disconnected, and connectivity will be interrupted for a short period of time.
Prerequisites
You already have an available cluster before you create a workload. If no cluster is available, create one by performing the operations in Buying a CCE Autopilot Cluster.
Installing the Add-on
- Log in to the CCE console and click the cluster name to go to the cluster console.
- In the navigation pane, choose Add-ons. On the right of the displayed page, find the NGINX Ingress Controller add-on and click Install.
- On the Install Add-on slide-out panel, configure the specifications.
You can adjust the number of add-on pods and resource quotas as needed. The single-pod deployment does not provide high availability. If the add-on pod fails, the add-on becomes unavailable.
- Configure the add-on parameters.
- Load Balancer: Select a dedicated load balancer. If no load balancer is available, create one. The load balancer must have at least two listeners, and ports 80 and 443 are not occupied by listeners.
- Admission Check: If this option is enabled, an admission check will be performed on the configuration of Nginx ingresses. If the configuration files fail the admission check, requests to the ingresses will be intercepted. For details about verification, see Access Control.
- Admission checks slow down the responses to ingress requests to some extent.
- Admission checks are only available for the add-on v2.4.1 or later.
- Nginx Parameters: Configuring the nginx.conf file will affect all managed ingresses. You can search for related parameters through ConfigMaps. If the parameters you configured are not included in the options listed in ConfigMaps, the parameters will not take effect.
For example, you can use the keep-alive-requests parameter to describe how to set the maximum number of requests for keeping active connections to 100.
{ "keep-alive-requests": "100" } - Error 404: By default, the 404 service provided by the add-on is used. To specify a custom 404 service, select the namespace and Service. If the Service does not exist, the add-on installation will fail.
- Click Install.
Components
| Component | Description | Resource Type |
|---|---|---|
| cceaddon-nginx-ingress-controller | NGINX Ingress Controller that provides flexible routing and forwarding for clusters. | Deployment |
| cceaddon-nginx-ingress-default-backend | Default backend of the Nginx ingress. The message "default backend - 404" is returned. | Deployment |
| cceaddon-nginx-ingress-admission-create | After webhooks are enabled, you can create a certificate for webhook verification. | Job |
| cceaddon-nginx-ingress-admission-patch | After webhooks are enabled, you can update the created certificate to the webhook configuration. | Job |
Release History
| Add-on Version | Supported Cluster Version | New Feature | Community Version |
|---|---|---|---|
| 4.0.12 |
|
| |
| 4.0.10 |
|
| |
| 4.0.1 |
| Supported CCE Autopilot clusters v1.32 and NGINX Ingress Controller v1.12.1. |
| Add-on Version | Supported Cluster Version | New Feature | Community Version |
|---|---|---|---|
| 2.4.28 |
| NGINX Ingress Controller was upgraded to v1.11.5. | |
| 2.4.14 |
|
| |
| 2.4.13 |
| Supported the community version v1.9.6. | |
| 2.4.12 |
| Fixed some issues. | |
| 2.4.11 |
| Fixed some issues. | |
| 2.4.10 |
| Fixed some issues. |
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot
