$ oc label node <example_node_name_one> node-role.kubernetes.io/sriov=
您可以将 Bluefield-2 网络设备从数据处理单元 (DPU) 模式切换到网络接口控制器 (NIC) 模式。
在执行以下文档中的任何任务之前,请确保您已安装 SR-IOV 网络运算符。
使用以下步骤将 Bluefield-2 从数据处理单元 (DPU) 模式切换到网络接口控制器 (NIC) 模式。
目前,仅支持将 Bluefield-2 从 DPU 模式切换到 NIC 模式。不支持从 NIC 模式切换到 DPU 模式。 |
您已安装 SR-IOV 网络运算符。有关更多信息,请参见“安装 SR-IOV 网络运算符”。
您已将 Bluefield-2 更新到最新的固件。有关更多信息,请参见NVIDIA BlueField-2 固件。
通过输入以下命令,将以下标签添加到每个工作节点
$ oc label node <example_node_name_one> node-role.kubernetes.io/sriov=
$ oc label node <example_node_name_two> node-role.kubernetes.io/sriov=
例如,为 SR-IOV 网络运算符创建一个机器配置池
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfigPool
metadata:
name: sriov
spec:
machineConfigSelector:
matchExpressions:
- {key: machineconfiguration.openshift.io/role, operator: In, values: [worker,sriov]}
nodeSelector:
matchLabels:
node-role.kubernetes.io/sriov: ""
将以下machineconfig.yaml
文件应用于工作节点
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfig
metadata:
labels:
machineconfiguration.openshift.io/role: sriov
name: 99-bf2-dpu
spec:
config:
ignition:
version: 3.2.0
storage:
files:
- contents:
source: data:text/plain;charset=utf-8;base64,ZmluZF9jb250YWluZXIoKSB7CiAgY3JpY3RsIHBzIC1vIGpzb24gfCBqcSAtciAnLmNvbnRhaW5lcnNbXSB8IHNlbGVjdCgubWV0YWRhdGEubmFtZT09InNyaW92LW5ldHdvcmstY29uZmlnLWRhZW1vbiIpIHwgLmlkJwp9CnVudGlsIG91dHB1dD0kKGZpbmRfY29udGFpbmVyKTsgW1sgLW4gIiRvdXRwdXQiIF1dOyBkbwogIGVjaG8gIndhaXRpbmcgZm9yIGNvbnRhaW5lciB0byBjb21lIHVwIgogIHNsZWVwIDE7CmRvbmUKISBzdWRvIGNyaWN0bCBleGVjICRvdXRwdXQgL2JpbmRhdGEvc2NyaXB0cy9iZjItc3dpdGNoLW1vZGUuc2ggIiRAIgo=
mode: 0755
overwrite: true
path: /etc/default/switch_in_sriov_config_daemon.sh
systemd:
units:
- name: dpu-switch.service
enabled: true
contents: |
[Unit]
Description=Switch BlueField2 card to NIC/DPU mode
RequiresMountsFor=%t/containers
Wants=network.target
After=network-online.target kubelet.service
[Service]
SuccessExitStatus=0 120
RemainAfterExit=True
ExecStart=/bin/bash -c '/etc/default/switch_in_sriov_config_daemon.sh nic || shutdown -r now' (1)
Type=oneshot
[Install]
WantedBy=multi-user.target
1 | 可选:可以可选地指定特定卡的 PCI 地址,例如ExecStart=/bin/bash -c '/etc/default/switch_in_sriov_config_daemon.sh nic 0000:5e:00.0 || echo done' 。默认情况下,选择第一个设备。如果有多个设备,则必须指定要使用的 PCI 地址。在将 Bluefield-2 从 DPU 模式切换到 NIC 模式的所有节点上,PCI 地址必须相同。 |
等待工作节点重新启动。重新启动后,工作节点上的 Bluefield-2 网络设备将切换到 NIC 模式。
可选:您可能需要重新启动主机硬件,因为大多数最新的 Bluefield-2 固件版本需要硬件重新启动才能切换到 NIC 模式。