After an application is created in a Container Service Kubernetes cluster or user-created Kubernetes cluster in Enterprise Distributed Application Service (EDAS), you can add a public or private Server Load Balancer (SLB) instance to the application so that the application can be accessed through the Internet or a private network. This topic describes how to add a public SLB instance to an application in a Container Service Kubernetes cluster.

Background

The differences for binding SLB instances to applications in Container Service Kubernetes clusters and user-created Kubernetes clusters are as follows:

  • In a user-created Kubernetes cluster: Purchase a new SLB instance for each application. The application exclusively uses the SLB instance.
  • In a Container Service Kubernetes cluster: Purchase a new SLB instance or reuse an SLB instance for each application. When a newly purchased SLB instance is used, the application exclusively uses the instance.
Note When a reused SLB instance is used, you must follow certain constraints and special operations. For more information, see Reuse SLB instances for applications in Container Service Kubernetes clusters.

Prerequisites

Create a CLB instance in the SLB console.
Important The created SLB instance must be in the same VPC as the application to which the SLB instance will be bound.

Bind an SLB instance to an application

  1. Log on to the EDAS console.
  2. In the left-side navigation pane, choose Application Management > Applications. In the top navigation bar, select the region. In the upper part of the Applications page, select the microservices namespace from the Microservice Namespace drop-down list and then click the name of the desired application.
  3. On the Application Overview page, click the Plus icon icon next to SLB (Public Network) in the Access configuration section.
    Note If you have bound a CLB instance to your application, the IP address and port number of the CLB instance are displayed. You can click the Editicon to modify the configuration or click theicon to unbind the CLB instance from your application.
  4. In the Add Public SLB Configuration Confirmation dialog box, set the SLB parameters and then click OK.
    • Choose SLB: You can use a new or an existing SLB instance.
      • Use a new SLB: The system automatically purchases a new SLB instance for your application. The information of the SLB instance is displayed at the bottom. You can also click View Price to learn about the price of the SLB instance.
        Important A new SLB instance cannot be reused by other applications. To reuse an SLB instance, select an existing SLB instance.
      • Use an existing SLB instance: Select an existing SLB instance from the drop-down list on the right.
    • SLB Port: This is the frontend port of the public SLB instance, which can be used to access the application. Value range: 1 - 65535.
    • Container Port: This is the port that listens to processes. The port is typically defined by the application. For example, a web application uses port 8080 by default.
    • Network Protocol: TCP is selected by default and cannot be changed.

Verify the result

In the address bar of your browser, enter <IP address of the SLB instance>:<port number of the SLB instance>, for example, 115.28.XX.XX:80, and then press Enter to go to the homepage of the corresponding application.

If the IP address and port number do not appear on the right side of the SLB instance, the binding failed. Go to the Change Logs page to view the change details, and troubleshoot the failure based on the change logs.

Feedback

If you have any questions about using Container Service Kubernetes clusters, you are welcome to scan the following QR code to join the DingTalk group for feedback.