All Products
Document Center

Simple routing - supports HTTP and HTTPS

Last Updated: Dec 28, 2017


  • Simple Layer-7 protocol load balancing
  • Web routing service
  • Services in a container cluster access each other using Layer-7 protocol by means of communication proxy and Server Load Balancer


See the following figure. When you create a cluster, a Server Load Balancer instance is assigned to the cluster by default. The Server Load Balancer instance adds all the nodes in the cluster to the backend. Port 80 is exposed at the frontend, and port 9080 is exposed on the machines of all the backend nodes. Container Service starts a routing application acsrouting, namely, the Alibaba Cloud Container Service Routing. This routing application has only one service, the routing service. The routing service is global, which means a copy of this service (or image), namely, a container, is deployed on each node (a node is also called a host or a virtual machine (VM) instance of Elastic Compute Service (ECS)). Each node uses this container to route HTTP services or HTTPS services.


As shown in the preceding figure, for HTTP services, the mapping between Server Load Balancer instance frontend and backend ports is 80:9080, and the port mapping between the host and the container used for routing is 9080:80, indicating that port 80 is exposed on the containers used for routing. Any ports can be exposed on the other containers used as the web service. After you set the port mapping between host and container during container startup, the routing service can obtain the corresponding port for request routing. For a complete example about how to expose HTTP services, see Create an Nginx webserver from an image.

Setup methods

Note: Make sure that the following kernel parameters (in the /etc/sysctl.conf file) of the related Container Service nodes are set to 0. Otherwise, the nodes might not be accessed.

  1. net.ipv4.conf.default.rp_filter = 0
  2. net.ipv4.conf.all.rp_filter = 0
  3. net.ipv4.conf.eth0.rp_filter = 0

Set in the Container Service console

Set by Services > Update

  1. Log on to the Container Service console.

  2. Click Services in the left-side navigation pane.

  3. Select the cluster in which the service to be exposed resides from the Cluster list.

  4. Click Update at the right of the service to be exposed (wordpress in this example).


  5. Configure the port mapping between host and container on the Update Service page.

    The host port is empty, indicating that a random port on the host is exposed (when HTTP or HTTPS services are exposed, you do not need to know what port is exposed on the host, because the container port can be directly accessed by using an overlay network or Virtual Private Cloud (VPC) network). The container port is 80. Use port 80 of the wordpress service to provide the HTTP service. The protocol used is TCP.


    Routing configuration exposes the service by using a domain name. Specify the port to be exposed (port 80 of the wordpress service in this example). Enter the domain name prefix in the Domain field. If the domain name prefix is XXX, the domain name XXX.$cluster_id.$ is obtained for testing. In this example, the domain name is obtained. You can enter your own domain name, which needs to add the resolution to the IP address of the corresponding Server Load Balancer instance. For how to configure the container port used for routing and the domain name of HTTP services, see routing label.

  6. Click Update after completing the configurations.

  7. Click the service name on the Service List page and then click the access endpoint to access the wordpress page.


  8. The wordpress welcome page appears.


Set by application template editor

  1. Log on to the Container Service console.

  2. Click Applications in the left-side navigation pane.

  3. Select the cluster from the Cluster list.

  4. Click Update at the right of the application (wordpress in this example).


  5. Add a routing label in Template, define the corresponding domain name or domain name prefix, update the application version, and confirm whether or not to pull the latest Docker image. Then, click OK to update the domain name.


  6. Click the application name on the Application List page and then click the Routes tab.

  7. Click the route address to access the wordpress welcome page.


Set by client