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 Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot