High-performance and high-availability Service Mesh (ASM) gateways ensure business continuity and improve user experience. This topic describes how to configure an ASM gateway and schedule the pods of the gateway to a specified node. This improves the high availability of the ASM gateway and enhances the isolation between gateway pods and application pods.
Prerequisites
Terms
Term | Description |
Taint | A taint allows a node to repel a set of pods. |
Toleration | Tolerations are applied to pods and allow the pods to be scheduled to nodes with matching taints. Note Taints and tolerations work together to prevent the system from scheduling pods to inappropriate nodes. One or more taints can be applied to a node.
|
Node affinity | Node affinity attracts pods to a set of nodes. Node affinity rules can be required or preferred. |
Step 1: Add a label to the desired node
Run the following command to obtain the names of the nodes in the specific cluster:
kubectl get nodes
Run the following command to add a label to the desired node:
# Command format kubectl label nodes <node-name> <label-key>=<label-value> # Sample command kubectl label nodes node1 mykey4pod=asmgateway
Step 2: Add a taint to the node
Run the following command to add a taint to the node:
kubectl taint nodes node1 mykey=myvalue:NoSchedule
This command adds a taint to node1
. The key is mykey
, the value is myvalue
, and the effect is NoSchedule
. This way, only pods that tolerate the taint can be scheduled to node1
.
Step 3: Set node affinity and tolerations for the ASM gateway
Configure the nodeAffinity
-related parameters of the ASM gateway so that pods of the ASM gateway are scheduled to the corresponding nodes. Configure the tolerations
parameters to match the taint created in Step 2 so that pods of the ASM gateway can be scheduled to node1.
- 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 Ingress Gateway page, find the gateway that you want to set and click YAML on the right.
In the Edit dialog box, add the following content to the
spec
field, and 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 node of the gateway pods meets expectations.
Log on to the ACK console and click Clusters in the left-side navigation pane.
On the Clusters page, click the name of a cluster and choose in the left-side navigation pane.
In the upper part of the Pods page, select istio-system from the Namespace drop-down list and check the node of the gateway pods.
If the node of the gateway pods meets expectations, the desired node affinity and tolerations are set for the ASM gateway.