Nginx Ingress Controller has been successfully deployed and bound to a public-facing SLB.
Note: Kubernetes clusters created via the Alibaba Cloud Container Service console automatically deploy an Nginx Ingress Controller during initialization, which is default-mounted to a public SLB instance.
II. Configuration
1. Create an Internal SLB
In the Alibaba Cloud console, create an internal SLB and bind it to your VPC.
# my-nginx-ingress-slb-intranet.yaml# intranet nginx ingress slb serviceapiVersion:v1kind:Servicemetadata:# Name the service as nginx-ingress-lb-intranet.name:nginx-ingress-lb-intranetnamespace:kube-systemlabels:app:nginx-ingress-lb-intranetannotations:# Specify the SLB instance type as internal.service.beta.kubernetes.io/alicloud-loadbalancer-address-type:intranet# Replace with your internal SLB instance ID.service.beta.kubernetes.io/alicloud-loadbalancer-id:<YOUR_INTRANET_SLB_ID># Whether to automatically create SLB port listeners (overrides existing ones); can also be configured manually.#service.beta.kubernetes.io/alicloud-loadbalancer-force-override-listeners: 'false'spec:type:LoadBalancer# Route traffic to other nodesexternalTrafficPolicy:"Cluster"ports:- port:80name:httptargetPort:80- port:443name:httpstargetPort:443selector:# Select pods with app=ingress-nginxapp:ingress-nginx
After configuring Ingress to expose services, you can access the service via the public SLB. Other services within the same VPC can directly access the service through the internal SLB.
3. Create Ingress Service
Once the Ingress controller is configured, creating an Ingress requires no special setup—just like before. Example: