Schedule ASM (Alibaba Cloud Service Mesh) gateway pods to specific nodes in your Kubernetes cluster to improve gateway high availability and isolate gateway pods from application pods. For example, distribute gateway pods across nodes in different failure domains for redundancy, or dedicate specific nodes to gateway workloads.
Prerequisites
Key concepts
The following table describes the Kubernetes scheduling concepts used in this topic:
Concept | Description |
node label | A key-value pair attached to a node. Node labels are used to tag nodes for pod scheduling. Node affinity rules reference these labels through |
taint | A key-value-effect attribute applied to a node that causes the node to repel pods that do not have a matching toleration. For example, a taint with key |
toleration | A key-value-effect attribute applied to a pod that allows the pod to be scheduled to a node with a matching taint. Taints and tolerations work together to control which pods can run on which nodes. Each node can have one or more taints applied. |
node affinity | A set of scheduling rules that determine which nodes a pod can be scheduled to based on node labels. Node affinity supports two types of rules. A required rule ( |
Step 1: Add a label to a node
Run the following command to query the node names in the cluster:
kubectl get nodesRun the following command to add a label to the target node:
# Command format
kubectl label nodes <node-name> <label-key>=<label-value>
# Example
kubectl label nodes node1 mykey4pod=asmgatewayStep 2: Add a taint to a node
Run the following command to add a taint to a node:
kubectl taint nodes node1 mykey=myvalue:NoScheduleThis command adds a taint to the node named node1. The taint has the key mykey, the value myvalue, and the effect NoSchedule. Only pods that have a matching toleration can be scheduled to the node1 node.
Step 3: Configure node affinity and tolerations for the ASM gateway
Configure the nodeAffinity parameter to distribute the ASM gateway pods to the specified nodes. Configure the tolerations parameter to match the taint that you created in Step 2 so that the gateway pods can be scheduled to the specified nodes.
-
Log on to the ASM console. In the left-side navigation pane, choose .
-
On the Mesh Management page, click the name of the ASM instance. In the left-side navigation pane, choose .
On the right side of the Ingress Gateway page, click View YAML for the target gateway.
In the Edit dialog box, add the following content under the
specfield, and then click OK.affinity: nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: nodeSelectorTerms: - matchExpressions: - key: mykey4pod operator: In values: - asmgateway tolerations: - key: "mykey" operator: "Equal" value: "myvalue" effect: "NoSchedule"Check whether the gateway pods run on the expected nodes.
-
Log on to the ACK console. In the left navigation pane, click Clusters.
-
On the Clusters page, click the name of your cluster. In the left navigation pane, click .
At the top of the Pods page, select the istio-system namespace and check whether the gateway pods run on the expected nodes.
If the gateway pods run on the target nodes, you have configured node affinity and tolerations for the ASM gateway.
-