This topic describes the labels that are related to application releases in clusters of Container Service for Swarm.

Swarm label Description Related Kubernetes parameter Sample Swarm configuration Sample Kubernetes configuration How to migrate
restart The policy for restarting the container. restartPolicy - - Automatically converted by Kompose.
aliyun.latest_image Specifies whether to pull the latest image. imagePullPolicy aliyun.latest_image: true For more information, see the sample Kubernetes configuration in aliyun.latest_image.

Migrate manually:

After you use Kompose to convert the Swarm compose file, add the imagePullPolicy field to the Kubernetes resource file *-deployment.yaml of the application. The default value is Always.

depends_on The dependencies of services. Uses methods such as init container, liveness probe, and readiness probe to implement features such as health check and dependency check. For more information, see Handle service dependencies. - - Depends on workload implementation.
aliyun.depends The dependencies of services. Uses methods such as init container, liveness probe, and readiness probe to implement features such as health check and dependency check. For more information, see Handle service dependencies. - - Depends on workload implementation.
environment: affinity:service! =db The constraints of service deployments. For more information, see Service deployment constraints (affinity:service). Uses labels such as nodeAffinity, podAffinity, and podAntiAffinity to configure affinity attributes of nodes and pods. For more information, see Affinity and anti-affinity. - - Depends on workload implementation.
environment: constraint:group==1 Specifies that pods are scheduled to nodes with the group:1 label. Uses nodeSelector to filter nodes. For more information, see nodeSelector. For more information, see the sample Swarm configuration in environment: constraint:group==1. For more information, see the sample Kubernetes configuration in environment: constraint:group==1.

Migrate manually:

After you use Kompose to convert the Swarm Compose file, add the nodeSelector field to the Kubernetes resource file *-deployment.yaml of the application.

aliyun.global Specifies whether the service is for global use. You can create DaemonSet type applications for global use. For more information, see DaemonSet. For more information, see the sample Swarm configuration in aliyun.global. For more information, see the sample Kubernetes configuration in aliyun.global.

Automatic conversion by using Kompose and manual modification are both required.

Modify the configurations:

After you use Kompose to convert the Swarm compose file, you must delete the status field in the generated Kubernetes resource file. The status field records intermediate statuses.

aliyun.scale The number of containers for the service. You can use this field to scale out the service. replicas aliyun.scale: '10' replicas: 10 Automatically converted by Kompose.
aliyun.rolling_updates Specifies whether to enable rolling update for the service. strategy.type.RollingUpdate. For more information, see Strategy. For more information, see the sample Swarm configuration in aliyun.rolling_updates and aliyun.rolling_updates.parallelism. For more information, see the sample Kubernetes configuration in aliyun.rolling_updates and aliyun.rolling_updates.parallelism.

Migrate manually:

After you use Kompose to convert the Swarm compose file, you must manually configure the rolling update policy.

aliyun.rolling_updates.parallelism The number of containers that are concurrently updated. maxUnavailable. For more information, see Strategy.

Migrate manually:

After you use Kompose to convert the Swarm compose file, you must manually configure the rolling update policy.

aliyun.auto_scaling. * The policy for automatically adjusting the number of containers for the service based on the container resource usage. For more information, see Container auto scaling. This label does not have a mapping field in Kubernetes. To enable auto scaling of pods, you can create an application and enable Horizontal Pod Autoscaling (HPA) in the Container Service for Kubernetes (ACK) console. For more information, see HPA. For more information, see the sample Swarm configuration in aliyun.auto_scaling. *. For more information, see the sample Kubernetes configuration in aliyun.auto_scaling. *.

Migrate manually:

After you deploy the Kubernetes resource file, configure HPA in the ACK console.

aliyun.probe.cmd The shell command for health check. For more information, see probe. livenessProbe For more information, see the sample Swarm configuration in aliyun.probe.cmd, aliyun.probe.initial_delay_seconds, and aliyun.probe.timeout_seconds. For more information, see the sample Kubernetes configuration in aliyun.probe.cmd, aliyun.probe.initial_delay_seconds, and aliyun.probe.timeout_seconds. Automatically converted by Kompose.
aliyun.probe.initial_delay_seconds The delay duration for health check after the container starts. Unit: seconds. For more information, see probe. livenessProbe
Note
  • In Swarm, health check is performed to check the container status. However, the container can provide services to external systems regardless of the status.

  • In Kubernetes, if a health check performed by liveness probe fails in a pod, Kubernetes forcibly restarts the pod. Therefore, you must set an appropriate delay period for the liveness probe. Otherwise, Kubernetes repeatedly restarts the pod and the application fails to start.

Automatically converted by Kompose.
aliyun.probe.timeout_seconds The timeout period of a health check. For more information, see probe. livenessProbe Automatically converted by Kompose.
aliyun.probe.url The URL to which the HTTP or TCP request for health check is sent. For more information, see probe. livenessProbe For more information, see the sample Swarm configuration in aliyun.probe.url. For more information, see the sample Kubernetes configuration in aliyun.probe.url. Automatically converted by Kompose.
extra_hosts The entries to be added to the hosts file of the container. The hostAliases parameter in Kubernetes. For more information, see Adding Additional Entries with HostAliases. For more information, see the sample Swarm configuration in extra_hosts. For more information, see the sample Kubernetes configuration in extra_hosts.

Migrate manually:

After you use Kompose to convert the Swarm compose file, add the hostAliases parameter to the Kubernetes resource file *-deployment.yaml of the application.

entrypoint The entry point to overwrite the default one. command For more information, see the sample Swarm configuration in entrypoint. For more information, see the sample Kubernetes configuration in entrypoint. Automatically converted by Kompose.
command The command to overwrite the default one. args For more information, see the sample Swarm configuration in command. For more information, see the sample Kubernetes configuration in command. Automatically converted by Kompose.

aliyun.latest_image

Sample Swarm configuration Sample Kubernetes configuration
aliyun.latest_image: true aliyun.latest_image

For more information, see config-deployment.yaml.

environment: constraint:group==1

Sample Swarm configuration Sample Kubernetes configuration
environment: constraint:group==1 environment: constraint:group==1

For more information, see auth-mongodb-deployment.yaml.

aliyun.global

Sample Swarm configuration Sample Kubernetes configuration
aliyun.global aliyun.global

For more information, see logtail2-daemonset.yaml.

aliyun.rolling_updates and aliyun.rolling_updates.parallelism

Sample Swarm configuration Sample Kubernetes configuration
1 1

For more information, see config-deployment.yaml.

aliyun.auto_scaling. *

Sample Swarm configuration Sample Kubernetes configuration
aliyun.auto_scaling. * aliyun.auto_scaling. *

aliyun.probe.cmd, aliyun.probe.initial_delay_seconds, and aliyun.probe.timeout_seconds

Sample Swarm configuration Sample Kubernetes configuration
aliyun.probealiyun.latest_image: true aliyun.probe.

For more information, see config-deployment.yaml.

aliyun.probe.url

Sample Swarm configuration Sample Kubernetes configuration
aliyun.probe.url probe

For more information, see gateway-deployment.yaml.

extra_hosts

Sample Swarm configuration Sample Kubernetes configuration
extra_hosts extra_hosts

For more information, see logtail2-daemonset.yaml.

entrypoint

Sample Swarm configuration Sample Kubernetes configuration
entrypoint entrypoint

For more information, see auth-service-deployment.yaml.

command

Sample Swarm configuration Sample Kubernetes configuration
command command

For more information, see auth-service-deployment.yaml.