nginx-ingress
Introduction
Kubernetes uses kube-proxy to expose Services and provide load balancing. The implementation is at the transport layer. When it comes to Internet applications, where a bucket-load of information is generated, forwarding needs to be more fine-grained, precisely and flexibly controlled by policies and load balancers to deliver higher 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. nginx-ingress is an add-on that uses ConfigMaps to store Nginx configurations. The Nginx ingress controller generates Nginx configurations for an ingress and writes the configurations to the pod of Nginx through Kubernetes API. These configurations can be modified and updated by reloading.
The nginx-ingress add-on in CCE is implemented using the open-source community chart and image. CCE does not maintain the add-on. Therefore, it is not recommended that the nginx-ingress add-on be used commercially.
You can visit the open source community for more information.

- When installing the add-on, you can add configurations by defining the Nginx configuration. The configurations take effect globally. This parameter is generated by configuring the nginx.conf file and affects all managed ingresses. You can search for related parameters in the ConfigMap. If the configured parameters are not included in the options listed in the ConfigMap, the configurations do not take effect.
- After the add-on is installed, you can interconnect with Nginx and add Kubernetes annotations to a specific ingress to customize its behavior when creating an ingress on the CCE console. For details about the Kubernetes annotations field, 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, you need to uninstall the nginx-ingress add-on and re-install it.
How nginx-ingress Works
nginx-ingress consists of the ingress object, ingress controller, and Nginx. The ingress controller assembles ingresses into the Nginx configuration file (nginx.conf) and reloads Nginx to make the changed configurations take effect. When it detects that the 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 nginx-ingress works.
- An ingress is a group of access rules that forward requests to specified Services based on domain names or URLs. Ingresses are stored in the object storage service etcd and are added, deleted, modified, and queried through APIs.
- The 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
- This add-on can be installed only in CCE clusters of v1.15 or later.
- kubernetes.io/ingress.class: "nginx" must be added to annotations of the ingress created by calling the API. If an existing ingress is connected, add kubernetes.io/ingress.class: "cce" to annotations.
- Dedicated load balancers must be the network type (TCP/UDP) supporting private networks (with a private IP).
Prerequisites
Before creating a workload, you must have an available cluster. If no cluster is available, create one according to Buying a CCE Cluster.
Installing the Add-on
The new console supports dedicated load balancers.
- Log in to the CCE console.
- In the navigation pane on the left, choose Add-ons and click Install under nginx-ingress.
- Set configuration parameters.
- Cluster: Select a cluster.
- Specifications: Select or customize add-on specifications as required.
- Load Balancer: Select a shared or dedicated load balancer. If no load balancer is available, create one first. The load balancer has at least two listeners, and ports 80 and 443 are not occupied by listeners.
- Nginx Settings: 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 those ConfigMaps, the parameters will not take effect.
- Default 404 Service: By default, the 404 service provided by the add-on is used. To customize the 404 service, enter the namespace/service name. If the service does not exist, the add-on installation will fail.
- Click Install.
Change History
Add-on Version |
Supported Cluster Version |
Community Version (for Only Clusters of v1.17 and Later) |
---|---|---|
2.2.1 |
/v1.25.*/ |
|
2.1.3 |
/v1.(19|21|23).*/ |
|
2.1.1 |
/v1.(19|21|23).*/ |
|
2.1.0 |
/v1.(19|21|23).*/ |
|
2.0.1 |
/v1.(19|21|23).*/ |
|
1.3.2 |
/v1.(15|17|19|21).*/ |
|
1.2.6 |
/v1.(15|17|19).*/ |
|
1.2.5 |
/v1.(15|17|19).*/ |
|
1.2.3 |
/v1.(15|17|19).*/ |
|
1.2.2 |
/v1.(15|17).*/ |
Feedback
Was this page helpful?
Provide feedbackFor any further questions, feel free to contact us through the chatbot.
Chatbot