Successfully deployed Nginx ingress controller and bound to the public network SLB
Note: The Kubernetes cluster created through the Alibaba Cloud Container Service Management Console will automatically deploy a set of Nginx Ingress Controllers during initialization, which is mounted on the public network SLB instance by default.
2. Configuration
1. Create an intranet LB
Alibaba Cloud Console, create an intranet SLB and bind it to VPC
# my-nginx-ingress-slb-intranet.yaml# intranet nginx ingress slb serviceapiVersion:v1kind:Servicemetadata:# The service here is named nginx-ingress-lb-intranet.name:nginx-ingress-lb-intranetnamespace:kube-systemlabels:app:nginx-ingress-lb-intranetannotations:# Indicates that the SLB instance address type is a private network type.service.beta.kubernetes.io/alicloud-loadbalancer-address-type:intranet# Change to your private network SLB instance ID.service.beta.kubernetes.io/alicloud-loadbalancer-id:<YOUR_INTRANET_SLB_ID># Whether to automatically create an SLB port listener (will overwrite the existing port listener), you can also manually create a port listener.#service.beta.kubernetes.io/alicloud-loadbalancer-force-override-listeners: 'false' spec: type: LoadBalancer # route traffic to other nodes externalTrafficPolicy: "Cluster" ports: - port: 80 name: http targetPort: 80 - port: 443 name: https targetPort: 443 selector: # select app=ingress-nginx pods app: ingress-nginx '`` Create service Resources: ```shell kubectl apply -f my-nginx-ingress-slb-intranet.yaml ``` Get service resources: ```shell # kubectl -n kube-system get svc | grep nginx-ingress-lb nginx-ingress-lb LoadBalancer 172.21.15.148 39.107.xxx.xxx 80:32076/TCP,443:30803/TCP 433dnginx-ingress-lb-intranet LoadBalancer 172.21.5.0 172.17.193.181 80:32282/TCP,443:30507/TCP 1d
When a service is exposed externally through Ingress, the service can be accessed through the public SLB, and other services under the same VPC can also directly access the service through the private SLB.
Create ingress service
After configuring ingress controller, no special configuration is required for ingress creation, which is exactly the same as creating ingress before, as shown in the following example: