Volcengine Kubernetes Engine (VKE) provides an Nginx Ingress controller built on the community edition. It can convert Ingress rules to Nginx configurations and perform 7-layer traffic forwarding through Nginx. This topic introduces how to configure Nginx Ingress using YAML.
Prerequisites
Creating Nginx Ingresses
Forwarding based on domain names
An NGINX Ingress can forward requests targeting different domain names to different back-end services.
- Create a YAML file for an Ingress. The following is an example named nginx-ingress.yaml.
- Execute the following command to create an Ingress.
Forwarding based on paths
An NGINX Ingress supports forwarding requests targeting different paths on the same domain name to different back-end services.
- Create a YAML file for Ingress. The following is an example named nginx-ingress.yaml.
- Execute the following command to create an Ingress.
Using custom Nginx Ingress controllers
You can use these NGINX Ingress controllers to provide different services externally as required. Procedure:
- Create a YAML file for Ingress. The following is an example named nginx-ingress.yaml. Specifically, use the name in the spec.ingressClassName field to specify the Nginx Ingress controller service. In the following example, the controller user-ingress-nginx is specified.
- Execute the following command to create an application and a service.
Validating results
Viewing configuration
- Run the following command to view the Ingress configuration.
- If the response is similar to the following one, the Ingress has been created. The address 180.xxx.xxx.xxx is the public or private IP of the CLB configured for the Nginx Ingress.
Testing the connections to services
Run the following command to access the service by using the domain name.
If the response is similar to the following one, the back-end service is accessible through the domain name.