This topic describes the labels that are related to network configurations in clusters of Container Service for Swarm.
Swarm label | Description | Related Kubernetes parameter | Sample Swarm configuration | Sample Kubernetes configuration | How to migrate |
---|---|---|---|---|---|
net | The network mode. This parameter is available only in a Swarm compose file of version 1. It is the same as the --net parameter used in the Docker CLI. For more information, see net. | Some parameters can be directly converted into Kubernetes. For example, net: "host" can be directly converted to hostNetwork: true. Other values are not supported in Kubernetes. For more information, see Host namespaces. | For more information, see the sample Swarm configuration in net. | For more information, see the sample Kubernetes configuration in net. |
Migrate manually: After you use Kompose to convert the Swarm compose file, you must manually delete unsupported parameters. |
aliyun.routing.port_ |
|
The ingress parameter. Kompose converts only the first domain name. You must manually add rules for other domain names. In addition, you must replace the test domain name. For more information, see Configure an Ingress. | For more information, see the sample Swarm configuration in aliyun.routing.port_. | For more information, see the sample Kubernetes configuration in aliyun.routing.port_. |
Automatic conversion by using Kompose and manual modification are both required. Manual modification:
|
aliyun.routing.session_sticky | Specifies whether to maintain a sticky session when the routing parameter is set for
routing requests.
Note This label must be used together with
routing .
|
Not supported in Kubernetes. | - | - | No need to migrate. |
hostname | The hostname used for accessing a Service across containers that run on different nodes based on Domain Name System (DNS) and Server Load Balancer (SLB). Typically, it is used by a Service to access another Service. | In Kubernetes, you can create a Service for accessing an application across pods. For more information, see Create a service. | For more information, see the sample Swarm configuration in hostname. | For more information, see the sample Kubernetes configuration in hostname. |
Migrate manually:
Note In Kubernetes, a Service name can contain only lowercase letters and hyphens (-).
If parameters such as hostname, links, and external_links contain other characters
such as dots (
. ), you must modify the application code to migrate these parameters to Kubernetes.
|
links |
|
|
For more information, see the sample Swarm configuration in links. | For more information, see the sample Kubernetes configuration in links. | |
external_links | This parameter connects two Services to enable communication between each other. Compared with the links parameter, the external_links parameter allows you to connect a Service to containers that are created through other Swarm compose files or in other methods. |
In a Kubernetes cluster, you can create a Service for accessing an application across pods. The pods must be managed by the Kubernetes cluster. Migration method:
|
For more information, see the sample Swarm configuration in external_links. | For more information, see the sample Kubernetes configuration in external_links. | |
|
The address of the external system to which the Service is directly linked.
|
The headless Service in Kubernetes. For more information, see Headless Services. | For more information, see the sample Swarm configuration in external: ***. | For more information, see the sample Kubernetes configuration in external: ***. |
Migrate manually:
|
aliyun.lb.port_* | The Service port to be exposed through an SLB instance to the public or internal networks in Network Address Translation (NAT) mapping mode. For more information, see Server Load Balancer routing. | Access the Service through an SLB instance, which is similar to load balancing in Swarm. For more information, see Use annotations to configure SLB instances. | For more information, see the sample Swarm configuration in aliyun.lb.port_*. | For more information, see the sample Kubernetes configuration in aliyun.lb.port_*. |
Migrate manually: After the Service is deployed, create a LoadBalancer type Service to access it through
an SLB instance. For more information, see Use annotations to configure SLB instances.
Note
|
dns | The upstream DNS server of the container. | The DNS configurations that apply to pods. For more information, see Pod's DNS Config.
Note If a DNS server is specified, the Service name may fail to be parsed.
|
For more information, see the sample Swarm configuration in dns. | For more information, see the sample Kubernetes configuration in dns. |
Migrate manually: After you use Kompose to convert the Swarm compose file, add the dnsConfig parameter to the Kubernetes resource file *-deployment.yaml of the application. |
net
Sample Swarm configuration | Sample Kubernetes configuration |
---|---|
![]() |
![]() For more information, see logtail2-daemonset.yaml. |
aliyun.routing.port_
Sample Swarm configuration | Sample Kubernetes configuration |
---|---|
![]() |
![]() For more information, see gateway-ingress.yaml. |
hostname
Sample Swarm configuration | Sample Kubernetes configuration |
---|---|
![]() |
![]() Note Create a Service with the same name (marked by 1 as shown in the figure) as the hostname
in the ACK console. Use the container port as the Service port.
|
links
Sample Swarm configuration | Sample Kubernetes configuration |
---|---|
![]() |
![]() Note Create Services with the same names as those specified by the links parameter in the
ACK console.
|
external_links
Sample Swarm configuration | Sample Kubernetes configuration |
---|---|
![]() |
![]() Note Create a Service with the same name as the one specified by the external_links parameter
in the ACK console.
|
external: ***
The external: *** parameter includes the following fields:
external:
host: $RDS_URL
ports:
- 3306
Sample Swarm configuration | Sample Kubernetes configuration |
---|---|
![]() |
![]() For more information, see account-db-service.yaml. |
aliyun.lb.port_*
Sample Swarm configuration | Sample Kubernetes configuration |
---|---|
![]() |
![]() |
dns
Sample Swarm configuration | Sample Kubernetes configuration |
---|---|
![]() |
![]() For more information, see logtail2-daemonset.yaml. |