To deploy a service to a specified node, you can use the
Note: The deployment constraint only works for newly created containers. It does not work when existing containers change the configurations.
In the following example, the service is deployed to node1.
Container Service supports the following expressions:
|constraint:aliyun.node_index==1||Deploy the service to node1.|
|constraint:aliyun.node_index!=1||Do not deploy the service to node1.|
|constraint:aliyun.node_index==(1|2|3)||Deploy the service to node1, node2, or node3.|
|constraint:aliyun.node_index!=(1|2|3)||Deploy the service to a machine other than node1, node2, and node3.|
|affinity:image==~redis||Try to deploy the service to a machine with a Redis image. The image full name is supported. For example, |
|affinity:service!=~redis||Try not to deploy the service to a machine with a Redis service. For more information, see Service deployment constraints (affinity:service).|