Usage
The Kubernetes NUMA affinity scheduling plugin allows you to specify CPU resource requirements during pod deployment. The system automatically allocates resources based on NUMA affinity. By compiling a YAML file and specifying the node selector, you can deploy a pod on a specific node.
After the plugin is deployed, you only need to specify the values of request and limit for CPU resources when deploying other pods. The system automatically allocates resources based on NUMA affinity.
The following is an example YAML file for deploying a single-container pod. The CPU resources requested by the pod are 4 cores at minimum, and 8 cores at maximum. The memory is fixed to 4 GiB. The container uses the test image openeuler:loop. By running the loop N command, the image can start N loop thread(s) and occupy a maximum of N CPU core(s).
- Create a YAML file example.yaml, and write the following configuration into the file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
apiVersion: v1 kind: Pod metadata: name: nri-test annotations: spec: containers: - name: nri-1 image: openeuler:loop imagePullPolicy: IfNotPresent command: ["loop"] args: ["10"] resources: requests: cpu: "4" memory: "4Gi" limits: cpu: "8" memory: "4Gi"
- In a Kubernetes cluster with multiple worker nodes, a pod can be scheduled to different NUMA nodes. To make the pod run on a specified node, add the nodeSelector field to the spec section in the YAML file and set kubernetes.io/hostname to the name of the target node.For example, to make the pod run on the compute01 node, add the following content to the spec section in the YAML file:
1 2
nodeSelector: kubernetes.io/hostname: compute01
- After the YAML file is modified, apply the file on the management node to complete pod deployment.
kubectl apply -f example.yaml