This topic describes how to use an existing Server Load Balancer (SLB) instance with an Ingress to set up forwarding. You can use an annotation to specify an SLB instance by ID when you create an Ingress.
Prerequisites
- A serverless Kubernetes (ASK) cluster is created. You must configure a network address translation (NAT) gateway for the virtual private cloud (VPC) where the cluster is created so that the cluster can download container images from the Internet. For more information, see Create an ASK cluster.
- The kubectl client is connected to the ASK cluster. For more information, see Use kubectl to connect to an ASK cluster.
- A guaranteed-performance SLB instance is created in the virtual private cloud (VPC)
where the ASK cluster is deployed. Guaranteed-performance SLB instances support elastic
network interfaces (ENIs).
- If you have an SLB instance in the VPC where the ASK cluster is deployed, you can log on to the SLB console and obtain the ID of the SLB instance on the Instances page.
- If you have no SLB instance, you must create a guaranteed-performance SLB instance in the VPC where the ASK cluster is deployed. For example, you can select the slb.s2.small instance type. The SLB instance can be internal-facing or Internet-facing. For more information, see Create a CLB instance.
- In this example, an Internet-facing SLB instance is used.
Procedure
Note The Ingress controller automatically opens port 80 and 443 on the SLB instance. Make
sure that port 80 and 443 are not used by other services.
Step 1: Deploy an application
Step 2: Configure an Ingress
Step 3: Access the application
Note You must resolve the domain name to the IP address of the SLB instance.
In this example, the following DNS rule is created for the domain name to enable access
to the test application. We recommend that you apply for an Internet Content Provider
(ICP) number for the domain name if the domain name is used in the production environment.
47.168.XX.XX bar.foo.com
- Access the tomcat application by using a browser.
- Access the tomcat application by using the command line tool.
curl -k -H "Host: bar.foo.com" https://47.168.XX.XX