This topic compares the network settings used in a Swarm cluster with those used in a Kubernetes cluster for creating an application through an image.

Create an application by using an image

If you create an application in the Container Service console by using an image, the Swarm cluster Web interface is different from the Kubernetes cluster Web interface.

Network configuration

The Network Configuration of a Swarm cluster is used to expose the access methods outside the cluster for an application.

Configure port mapping

Container Service Swarm clusters

With the Port Mapping function of a Swarm cluster, you can map the application port to a host so that each host actives the same port. Then the application can be accessed through <HostIP>:<Port>.



Container Service Kubernetes clusters

To implement the port mapping function in a Kubernetes cluster, you can create a NodePort type service by using either of the following two methods:

Method 1: Configure port mapping when creating an application
  1. After you complete the Container setting, configure the Advanced setting. Specifically, click Create on the right of Service in the Access Control area.

  2. Select the NodePort Type. For more information, see Create a deployment application by using an image.

Method 2: Configure port mapping when creating a service

  1. In the left-side navigation pane in the Container Service console, choose Discovery and Load Balancing > Service.
  2. Select the target cluster and namespace, and click Create. In the Create Service dialog box, select the NodePort Type. For more information, see Create a service.

Configure simple routing

Container Service Swarm clusters

With the Simple Routing function of a Swarm cluster, you can access an application through a domain name. You can use the domain name provided by Container Service or customize the domain name.

Container Service Kubernetes clusters

In a Kubernetes cluster, you can create an Ingress to implement simple routing. In addition, the Ingress function of Container Service for Kubernetes provides blue/green deployment and gray releases. For more information, see Gray releases and blue/green deployment.

Two methods are available to implement the Ingress function in a Kubernetes cluster.

Method 1: Configure an Ingress when creating an application
  1. After you complete the Container setting, configure the Advanced setting. Specifically, click Create on the right of Ingress in the Access Control area.

  2. For more information, see Create a deployment application by using an image.

Method 2: Configure an Ingress directly
  1. In the left-side navigation pane in the Container Service console, choose Discovery and Load Balancing > Ingress.
  2. Select the target cluster and namespace, and click Create. For more information, see Create an Ingress in Container Service console.

Configure Server Load Balancer

Container Service Swarm clusters

With the Load Balancer function of a Swarm cluster, you can use Alibaba Cloud Server Load Balancer to expose the access method of an application. You must create an SLB and then associate the ID and the port number of the created SLB with the application so that you can access the application through <SLB_IP>:<Port>.

Container Service Kubernetes clusters

In a Kubernetes cluster, you can also expose the access method of an application by associating an SLB with the application. An SLB can be automatically created in a Kubernetes cluster through an SLB service. For SLB access, you can select either Internet access method or internal cluster access method. If you use a YAML file to create an application, you can specify an existing SLB and set session persistence. For more information, see Create a service.

Two methods are available to create an SLB service in a Kubernetes cluster.

Method 1: Configure an SLB service when creating an application
  1. After you complete the Container setting, configure the Advanced setting. Specifically, click Create on the right of Service in the Access Control area.

  2. Select the Server Load Balancer Type. For more information, see Create a deployment application by using an image.

Method 2: Create an SLB service directly

  1. In the left-side navigation pane in the Container Service console, chooseDiscovery and Load Balancing > Service.
  2. Select the target cluster and namespace, and click Create. In the Create Service dialog box, select the Server Load Balancer Type. For more information, see Create a service.