High availability scheduling

Last Updated: Nov 15, 2017

To make the application have higher availability, Container Service supports scheduling containers of the same service in different zones. When a zone malfunctions, the application can still provide services.

You can specify the zone selection in the orchestration file by using the environment variables in the following formats:

  • availability:az==3

    The service must be distributed in at least three zones. The container creation fails if less than three zones are in the current cluster, or the service cannot be distributed in three zones because of limited machine resources.

  • availability:az==~3

    Try to distribute the service in three zones. Container can still be created even if the condition cannot be met.

Note: The deployment constraint only works for newly created containers. It does not work when containers created in the past change the configurations.

In the following example, the service must be distributed in at least two zones.

  1. nnn:
  2. expose:
  3. - 443/tcp
  4. - 80/tcp
  5. image: 'nginx:latest'
  6. environment:
  7. - 'availability:az==2'
  8. labels:
  9. aliyun.scale: '8'
  10. restart: always
  11. volumes:
  12. - /var/cache/nginx
Thank you! We've received your feedback.