SR-IOV NIC Passthrough
When using this feature, add the following fields to the YAML file of the service application Pod.
- In annotations of the Pod, specify the network k8s.v1.cni.cncf.io/networks: sriov-net1. sriov-net1 is configured by the name field in the sriov-crd.yaml file.
apiVersion: v1 kind: Pod metadata: name: testpod2 annotations: k8s.v1.cni.cncf.io/networks: sriov-net1 - Add the huawei.com/huawei_1822_netdevice: "1" field to resources of the Pod. This field, specified by the configMap.yaml configuration file of the SR-IOV device plugin, follows the format of resourcePrefix/resourceName: "1".
resources: requests: huawei.com/huawei_1822_netdevice: "1" cpu: 1 limits: huawei.com/huawei_1822_netdevice: "1" cpu: 2 - Deploy a container, access the container, and check whether the network interface is successfully generated.
docker exec -it 8ba9054e6de1 /bin/sh
If it is created, you can see the net1 network interface in the output after executing the following command.
ip a
As shown in the following information, the net1 network interface is displayed, and the IP address belongs to the SR-IOV network. In this case, the network interface is created successfully.1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever 3: eth0@if662: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1450 qdisc noqueue link/ether fa:f9:09:1f:dd:12 brd ff:ff:ff:ff:ff:ff inet 10.244.1.22/24 brd 10.244.1.255 scope global eth0 valid_lft forever preferred_lft forever 602: net1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq qlen 1000 link/ether e6:5d:99:42:04:d6 brd ff:ff:ff:ff:ff:ff inet 10.56.217.2/24 brd 10.56.217.255 scope global net1 valid_lft forever preferred_lft forever
Parent topic: Plugin Usage