By Xining Wang
The Alibaba Cloud Service Mesh (ASM) serverless gateway is built on virtual nodes and Elastic Container Instance. It applies to scenarios that require elastic resources and do not require node maintenance.
virtual-kubelet.io/provider=alibabacloud:NoSchedule
taint. This prevents accidental usage of elastic container instances.virtual-kubelet.io/provider=alibabacloud:NoSchedule
taint. tolerations:
- key: virtual-kubelet.io/provider
operator: Equal
value: alibabacloud
effect: NoSchedule
• If you create an ASM gateway in a Serverless Kubernetes (ASK) cluster in the ASM console, the pods run on elastic container instances, and you do not need to perform the operations described in this article.
• The following procedure applies to an ACK cluster (an ACK standard cluster, an ACK Pro cluster, or an ACK dedicated cluster). You must deploy the ack-virtual-node component. For more information, see Deploy ack-virtual-node component.
Run kubectl get nodes 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
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.
Configure the nodeAffinity parameters of the ASM gateway so that the pods of the ASM gateway are scheduled to the corresponding nodes.
Configure the tolerations parameters to match the taint created in Step 2. As such, the pods of the ASM gateway can be scheduled to node 1.
Procedures:
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- preference:
matchExpressions:
- key: type
operator: In
values:
- virtual-kubelet
weight: 20
- preference:
matchExpressions:
- key: mykey4pod
operator: In
values:
- asmgateway
weight: 80
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: mykey4pod
operator: In
values:
- asmgateway
- matchExpressions:
- key: type
operator: In
values:
- virtual-kubelet
tolerations:
- effect: NoSchedule
key: virtual-kubelet.io/provider
operator: Equal
value: alibabacloud
- effect: NoSchedule
key: mykey
operator: Equal
value: myvalue
Notes
preferredDuringSchedulingIgnoredDuringExecution
parameter is associated with two matchExpressions
fields. When using the configuration with a weight of 20, pods are scheduled to use elastic container instances. When using the configuration with a weight of 80, pods are scheduled to ECS nodes with the specified label. Additionally, the weight values are relative, and a configuration with a higher value is preferred.requiredDuringSchedulingIgnoredDuringExecution
parameter is associated with two matchExpressions
fields. One indicates that pods are scheduled to ECS nodes with the specified label, and the other indicates that pods are scheduled to use elastic container instances.virtual-kubelet.io/provider=alibabacloud:NoSchedule
taint and can use elastic container instances.56 posts | 8 followers
FollowAlibaba Cloud Native Community - September 20, 2023
Alibaba Cloud Native Community - December 18, 2023
Xi Ning Wang(王夕宁) - August 7, 2023
Alibaba Clouder - July 15, 2020
Alibaba Container Service - August 30, 2024
Xi Ning Wang(王夕宁) - August 7, 2023
56 posts | 8 followers
FollowAlibaba Cloud Function Compute is a fully-managed event-driven compute service. It allows you to focus on writing and uploading code without the need to manage infrastructure such as servers.
Learn MoreAccelerate and secure the development, deployment, and management of containerized applications cost-effectively.
Learn MoreVisualization, O&M-free orchestration, and Coordination of Stateful Application Scenarios
Learn MoreServerless Application Engine (SAE) is the world's first application-oriented serverless PaaS, providing a cost-effective and highly efficient one-stop application hosting solution.
Learn MoreMore Posts by Xi Ning Wang(王夕宁)