K8s FailedCreatePodSandBox 找不到 PF 设备

问题描述 投票:0回答:1

我是 K8s 新手。所以,这可能是我的小错误或大错误,但我无法自己解决这个问题。所以我在这里介绍我的设置详细信息和问题。

我正在使用同一台机器上有 2 个节点的 minikube 集群。

 minikube profile list
|----------|-----------|---------|--------------|------|---------|---------|-------|--------|
| Profile  | VM Driver | Runtime |      IP      | Port | Version | Status  | Nodes | Active |
|----------|-----------|---------|--------------|------|---------|---------|-------|--------|
| minikube | docker    | docker  | 192.168.76.2 | 8443 | v1.27.4 | Running |     2 | *      |
|----------|-----------|---------|--------------|------|---------|---------|-------|--------|

我从 1 个 PF 创建了 2 个 VF。

eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
    link/ether 0c:c4:7a:77:f9:80 brd ff:ff:ff:ff:ff:ff
    vf 0     link/ether 1e:4c:7c:6b:7d:0f brd ff:ff:ff:ff:ff:ff, spoof checking on, link-state auto, trust off, query_rss off
    vf 1     link/ether 9e:52:6e:e0:e9:07 brd ff:ff:ff:ff:ff:ff, spoof checking on, link-state auto, trust off, query_rss off

我想创建一个具有多个接口的POD。我还想将 1 个 VF 与 1 个 POD 链接。

为此,我安装了 SRIOV-CNI 并将 SRIOV 二进制文件按照文档中的建议放置在 /opt/cni/bin 文件夹中。

之后我下载了 sriov-network-device-plugin 并创建并应用了配置映射。 以下是我的配置文件的摘录

apiVersion: v1
kind: ConfigMap
metadata:
  name: sriovdp-config
  namespace: kube-system
data:
  config.json: |
    {
        "resourceList": [{
                "resourceName": "intel_sriov_netdevice",
                "selectors": {
                    "vendors": ["8086"],
                    "devices": ["15a8"],
                    "drivers": ["ixgbevf"]
                }
            },

k -n kube-system get pod -l app=sriovdp -o wide
NAME                                   READY   STATUS    RESTARTS   AGE     IP             NODE           NOMINATED NODE   READINESS GATES
kube-sriov-device-plugin-amd64-64bf7   1/1     Running   0          5h41m   192.168.76.2   minikube       <none>           <none>
kube-sriov-device-plugin-amd64-7knxh   1/1     Running   0          5h41m   192.168.76.3   minikube-m02   <none>           <none>

我的节点也能够看到我的 VF

 kubectl get node  minikube -o jsonpath='{.status.allocatable}' |jq -r '."intel.com/intel_sriov_netdevice"'
2

我也应用了 multus daemonset。

k get pod -l app=multus -A -o wide
NAMESPACE     NAME                   READY   STATUS    RESTARTS   AGE     IP             NODE           NOMINATED NODE   READINESS GATES
kube-system   kube-multus-ds-47zg5   1/1     Running   0          5h38m   192.168.76.2   minikube       <none>           <none>
kube-system   kube-multus-ds-rjrzn   1/1     Running   0          5h38m   192.168.76.3   minikube-m02   <none>           <none>

完成所有这些后,当我尝试启动 POD 时,它被卡住了。还没有上来。

来自 POD 的日志是:

Events:
  Type     Reason                  Age                From               Message
  ----     ------                  ----               ----               -------
  Normal   Scheduled               15s                default-scheduler  Successfully assigned default/testpod1 to minikube-m02
  Normal   AddedInterface          14s                multus             Add eth0 [10.244.1.32/24] from kindnet
  Warning  FailedCreatePodSandBox  14s                kubelet            Failed to create pod sandbox: rpc error: code = Unknown desc = failed to set up sandbox container "0f5d4259dfaa0087fba50ee5c656050fc6af6c01430bdd820e0642fba9d384de" network for pod "testpod1": networkPlugin cni failed to set up pod "testpod1_default" network: plugin type="multus" name="multus-cni-network" failed (add): [default/testpod1/:sriov-network]: error adding container to network "sriov-network": SRIOV-CNI failed to load netconf: LoadConf(): failed to get VF information: "PF network device not found"
  Normal   AddedInterface          13s                multus             Add eth0 [10.244.1.33/24] from kindnet
  Warning  FailedCreatePodSandBox  12s                kubelet            Failed to create pod sandbox: rpc error: code = Unknown desc = failed to set up sandbox container "39c2cc9ceff18eb34fbd4f7b0746fd0807a3999fdcef6f8dd8487b43f812a31a" network for pod "testpod1": networkPlugin cni failed to set up pod "testpod1_default" network: plugin type="multus" name="multus-cni-network" failed (add): [default/testpod1/:sriov-network]: error adding container to network "sriov-network": SRIOV-CNI failed to load netconf: LoadConf(): failed to get VF information: "PF network device not found"
  Normal   AddedInterface          12s                multus             Add eth0 [10.244.1.34/24] from kindnet
  Warning  FailedCreatePodSandBox  11s                kubelet            Failed to create pod sandbox: rpc error: code = Unknown desc = failed to set up sandbox container "20fb94f524db27d3b1bcb0e743c925ddb6af038c9220de28cd84ec92215b0ab3" network for pod "testpod1": networkPlugin cni failed to set up pod "testpod1_default" network: plugin type="multus" name="multus-cni-network" failed (add): [default/testpod1/:sriov-network]: error adding container to network "sriov-network": SRIOV-CNI failed to load netconf: LoadConf(): failed to get VF information: "PF network device not found"
kubernetes networking minikube cni
1个回答
0
投票

根据 Vinayak Pandey 撰写的文章,当您尝试创建 Pod 时,有不同的场景可能会导致

FailedCreatePodSandBox
错误。一般来说,您可以检查 CNI 是否在节点上工作,如果所有 CNI 配置文件都正确,那么您还应该验证系统资源限制是否设置正确。

场景1:CNI在节点上不工作

Kubernetes 容器网络接口 (CNI) 配置 Pod 之间的网络。如果 CNI 在节点上运行不正常,则无法创建 Pod,因为它们将陷入

ContainerCreating
状态。

由于您的环境中有 2 个节点,因此您需要按照文章中提到的步骤防止 SRIOV-CNI 在一个节点上运行。

调试与解决

该错误消息表明该 pod 计划运行的节点上的 CNI 无法正常运行,因此第一步应该检查该节点上的 CNI pod 是否正在运行。如果 CNI pod 正常运行,一个可能的根本原因是“已消除”。在这种情况下,一旦从 DaemonSet 定义中删除 nodeSelector 并确保 CNI pod 在节点上运行,该 pod 就应该运行良好。

场景2:CNI配置文件丢失或不正确

即使 CNI Pod 正在运行,如果 CNI 配置文件有错误,也可能会出现一些问题。为了模拟这一点,您需要按照

文章

中提到的步骤对存储在/etc/cni/net.d目录下的CNI配置文件进行一些更改。

调试与解决

在此场景中,请验证CNI配置文件。您可以检查集群中其他节点的配置文件,并验证这些文件是否与有问题的节点中的配置文件相似。如果您发现配置文件有任何问题,请将配置文件从其他节点复制到该节点,然后尝试重新创建 pod。

© www.soinside.com 2019 - 2024. All rights reserved.