Updated on 2026-05-20 GMT+08:00

Configuring HA Scheduling

Scenario

When using the CCE Cloud Bursting Engine for CCI add-on, you need to configure a multi-AZ scheduling policy to avoid service interruptions if the only pod in the AZ becomes faulty. This ensures that elastic resources are highly reliable when you handle traffic peaks.

Multi-AZ Scheduling for HA (topologySpreadConstraints)

In the scenario where CCE workload pods are scheduled to CCI (based on standard Kubernetes), you can use pod topology spread constraints to control how pods are spread. Compared with the traditional anti-affinity, pod topology spread constraints can control the distribution deviation of pods across AZs more precisely.

Key: topology.kubernetes.io/zone

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    bursting.cci.io/burst-to-cci: enforce          
  name: app-bursting-ha
spec:
  replicas: 5
  selector:
    matchLabels:
      app: bursting-app
  template:
    metadata:
      labels:
        app: bursting-app
    spec:
      # Ensure that pods are evenly distributed in different AZs. The maximum deviation is 1.
      topologySpreadConstraints:
        - maxSkew: 1
          topologyKey: topology.kubernetes.io/zone
          whenUnsatisfiable: ScheduleAnyway # Break constraints when resources are insufficient. Services are preferentially guaranteed.
          labelSelector:
            matchLabels:
              app: bursting-app
      containers:
      - name: container-0
        image: nginx:alpine

Scheduling to a Specified AZ

If you want the pods to run in a specific AZ (for example, to access the CCE node database in the specified AZ over the private network at low latency), you can use nodeSelector or nodeAffinity.

Using nodeSelector (the simplest mode)

The following is an example YAML file:

apiVersion: v1
kind: Pod
metadata:
  labels:
    bursting.cci.io/burst-to-cci: enforce 
  name: bursting-pinned-pod
spec:
  nodeSelector:
    # Forcibly schedule the pods to a specified AZ.
    topology.kubernetes.io/zone: cn-north-4a
  containers:
  - name: nginx
    image: nginx:latest