Container Service for Kubernetes:Use labels to schedule pods to FPGA-accelerated nodes
Last Updated:May 19, 2022
When FPGAs are used for computing in a Container Service for Kubernetes (ACK) cluster,
you can schedule pods to FPGA-accelerated nodes. This allows you to make full use
of FPGA resources. This topic describes how to schedule pods to FPGA-accelerated nodes
by using labels.
You are connected to the ACK cluster. This way, you can view the labels that are added
to the nodes. For more information, see Use kubectl to connect to an ACK cluster.
Background information
When you deploy FPGA-accelerated nodes in an ACK cluster, FPGA-related attributes
are exposed by node labels. This offers the following benefits:
You can use the labels to filter FPGA-accelerated nodes.
The labels can be used as conditions to schedule pods.
Step 1: View the labels of the FPGA-accelerated nodes
Method 1: View the labels of the FPGA-accelerated nodes in the console
On the Clusters page, find the cluster that you want to manage and click the name of the cluster
or click Details in the Actions column. The details page of the cluster appears.
In the left-side navigation pane of the details page, choose Nodes > Node.
On the Nodes page, find the FPGA-accelerated node that you want to manage, and choose More > Details in the Actions column.
View the labels of the FPGA-accelerated node.
Method 2: Run the kubectl command to view the labels of the FPGA-accelerated nodes
Run the following command to view the details of the FPGA-accelerated nodes:
kubectl get nodes
Expected output:
NAME STATUS ROLES AGE VERSION
cn-beijing.192.168.XX.X1 Ready <none> 3h51m v1.18.8-aliyun.1
cn-beijing.192.168.XX.X2 Ready <none> 3h41m v1.18.8-aliyun.1
Select an FPGA-accelerated node and run the following command to view the labels of
the FPGA-accelerated node:
The output shows that the fpga.k8s.aliyun.com=f3 label is added to the FPGA-accelerated node. The label is used to schedule pods in
the following example.
Step 2: Schedule pods to the FPGA-accelerated nodes
On the Clusters page, find the cluster that you want to manage and click the name of the cluster
or click Details in the Actions column. The details page of the cluster appears.
In the left-side navigation pane of the details page, choose Workloads > Deployments.
On the Deployments page, click Create from YAML in the upper-right corner.
Select a custom template from the drop-down list of sample templates, and copy the
following content to the Template field.
Note Replace the value of <your image> with the address of your custom image.
Click Create.
In the left-side navigation pane of the details page, choose Workloads > Pods.
In the list of pods, you can view that the specified pod is scheduled to the required
FPGA-accelerated node. You can use labels to schedule pods to specific FPGA-accelerated
nodes with ease.