×
Community Blog Schedule the Pods of an ASM Gateway to a Specified Node

Schedule the Pods of an ASM Gateway to a Specified Node

This article describes how to configure an ASM gateway and schedule the pods of the gateway to a specified node.

By Xining Wang

High-performance and high-availability of Alibaba Cloud Service Mesh (ASM) gateways ensure business continuity and improve user experience. This article 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.

Terms

  • Taint: A taint is applied to a node and allows the node to repel a specific set of pods.
  • Toleration: Toleration is applied to pod. Toleration allows the pods to be scheduled to nodes with corresponding taints.
  • Taints and tolerations work together to prevent the system from scheduling pods on inappropriate nodes. A node can have one or more taints. If a pod does not tolerate a specific taint, a node with the corresponding taint will not accept the pod. However, if a pod tolerates a specific taint, it can be scheduled on a node with the corresponding taint, but it is not mandatory.
  • nodeAffinity: NodeAffinity rules can be required or preferred. If no preferred or soft rules are met, the pods will be scheduled on other available nodes.

Procedures

Step 1: Add a Label to the Desired Node

Run kubectl get nodes command to obtain the names of the nodes in the specific cluster. Select a node to which you want to add a label and execute the kubectl label nodes = command to add the label to the desired node.

For example,

kubectl label nodes node1 mykey4pod=asmgateway

Step 2: Add a Taint to the Node

Run kubectl taint to add a taint to the node. For example,

kubectl taint nodes node1 mykey=myvalue:NoSchedule

This command adds a taint to node 1. 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 node 1.

Step 3: Set Node Affinity and Tolerations for the ASM Gateway

Configure the nodeAffinity-related parameters of the ASM gateway so that the pods of the ASM gateway are scheduled to the corresponding nodes. Configure the tolerations-related parameters to match the taint created in Step 2. In this way, the pods of the ASM gateway can be scheduled to a specified node.

Procedure:

1) Log on to the ASM console. In the left-side navigation pane, choose Service Mesh > Mesh Management.

2) On the Mesh Management page, click the name of the ASM instance. In the left-side navigation pane, choose ASM Gateways > Ingress Gateway.

3) On the Ingress Gateway page, find the gateway that you want to set and click YAML on the right.

4) 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"            

In the ACK console, check whether the node where the pods of the gateway are located meets expectations.

0 1 0
Share on

Xi Ning Wang(王夕宁)

56 posts | 8 followers

You may also like

Comments

Xi Ning Wang(王夕宁)

56 posts | 8 followers

Related Products