k8snetworkplumbingwg / multus-cni

A CNI meta-plugin for multi-homed pods in Kubernetes
Apache License 2.0
2.36k stars 585 forks source link

Failed to create pod sandbox: rpc error: code = Unknown desc #581

Closed withlin closed 3 years ago

withlin commented 3 years ago

What happend:

  Type     Reason                  Age                     From               Message
  ----     ------                  ----                    ----               -------
  Normal   Scheduled               9m54s                   default-scheduler  Successfully assigned kube-system/samplepod to zhc-netmis-compass-node01
  Normal   AddedInterface          9m53s                   multus             Add eth0 [10.16.0.40/16]
  Warning  FailedCreatePodSandBox  9m52s                   kubelet            Failed to create pod sandbox: rpc error: code = Unknown desc = [failed to set up sandbox container "e1a7c40a9b0b4b038a81c0d00548b3890632494a686f4351ffb5f277fe65c105" network for pod "samplepod": networkPlugin cni failed to set up pod "samplepod_kube-system" network: [kube-system/samplepod:macvlan-conf]: error adding container to network "macvlan-conf": Link not found, failed to clean up sandbox container "e1a7c40a9b0b4b038a81c0d00548b3890632494a686f4351ffb5f277fe65c105" network for pod "samplepod": networkPlugin cni failed to teardown pod "samplepod_kube-system" network: delegateDel: error invoking DelegateDel - "macvlan": error in getting result from DelNetwork: Link not found]
  Normal   SandboxChanged          4m52s (x25 over 9m52s)  kubelet            Pod sandbox changed, it will be killed and re-created.
[root@zhc-netmis-compass-master01 dpdk]#

What you expected to happen: It should create po How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

Environment:

   [root@zhc-netmis-compass-master01 dpdk]# cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
   [root@zhc-netmis-compass-master01 dpdk]# kubectl get net-attach-def -o yaml
apiVersion: v1
items:
- apiVersion: k8s.cni.cncf.io/v1
  kind: NetworkAttachmentDefinition
  metadata:
    creationTimestamp: "2020-11-08T11:14:56Z"
    generation: 1
    managedFields:
    - apiVersion: k8s.cni.cncf.io/v1
      fieldsType: FieldsV1
      fieldsV1:
        f:spec:
          .: {}
          f:config: {}
      manager: kubectl-create
      operation: Update
      time: "2020-11-08T11:14:56Z"
    name: macvlan-conf
    namespace: kube-system
    resourceVersion: "45837"
    selfLink: /apis/k8s.cni.cncf.io/v1/namespaces/kube-system/network-attachment-definitions/macvlan-conf
    uid: 546f6430-d02d-4fe3-8316-6cbe8c916546
  spec:
    config: '{ "cniVersion": "0.3.0", "type": "macvlan", "master": "eth0", "mode":
      "bridge", "ipam": { "type": "host-local", "subnet": "192.168.1.0/24", "rangeStart":
      "192.168.1.200", "rangeEnd": "192.168.1.216", "routes": [ { "dst": "0.0.0.0/0"
      } ], "gateway": "192.168.1.1" } }'
- apiVersion: k8s.cni.cncf.io/v1
  kind: NetworkAttachmentDefinition
  metadata:
    annotations:
      kubectl.kubernetes.io/last-applied-configuration: |
        {"apiVersion":"k8s.cni.cncf.io/v1","kind":"NetworkAttachmentDefinition","metadata":{"annotations":{},"name":"macvlan-conf1","namespace":"kube-system"},"spec":{"config":"{ \"cniVersion\": \"0.3.0\", \"type\": \"macvlan\", \"master\": \"eth0\", \"mode\": \"bridge\", \"isGateway\": true, \"ipMasq\": false, \"ipam\": { \"type\": \"host-local\", \"subnet\": \"10.200.108.0/24\", \"rangeStart\": \"10.200.108.237\", \"rangeEnd\": \"10.200.108.240\", \"routes\": [ { \"dst\": \"0.0.0.0/0\" } ], \"gateway\": \"10.200.108.254\" } }"}}
    creationTimestamp: "2020-11-08T11:09:13Z"
    generation: 2
    managedFields:
    - apiVersion: k8s.cni.cncf.io/v1
      fieldsType: FieldsV1
      fieldsV1:
        f:metadata:
          f:annotations:
            .: {}
            f:kubectl.kubernetes.io/last-applied-configuration: {}
        f:spec:
          .: {}
          f:config: {}
      manager: kubectl-client-side-apply
      operation: Update
      time: "2020-11-08T11:10:45Z"
    name: macvlan-conf1
    namespace: kube-system
    resourceVersion: "44703"
    selfLink: /apis/k8s.cni.cncf.io/v1/namespaces/kube-system/network-attachment-definitions/macvlan-conf1
    uid: b37ed784-19fe-4831-b66a-1275e813d9db
  spec:
    config: '{ "cniVersion": "0.3.0", "type": "macvlan", "master": "eth0", "mode":
      "bridge", "isGateway": true, "ipMasq": false, "ipam": { "type": "host-local",
      "subnet": "10.200.108.0/24", "rangeStart": "10.200.108.237", "rangeEnd": "10.200.108.240",
      "routes": [ { "dst": "0.0.0.0/0" } ], "gateway": "10.200.108.254" } }'
- apiVersion: k8s.cni.cncf.io/v1
  kind: NetworkAttachmentDefinition
  metadata:
    creationTimestamp: "2020-11-08T09:32:09Z"
    generation: 1
    managedFields:
    - apiVersion: k8s.cni.cncf.io/v1
      fieldsType: FieldsV1
      fieldsV1:
        f:spec:
          .: {}
          f:config: {}
      manager: kubectl-create
      operation: Update
      time: "2020-11-08T09:32:09Z"
    name: ovs-dpdk-br0
    namespace: kube-system
    resourceVersion: "20975"
    selfLink: /apis/k8s.cni.cncf.io/v1/namespaces/kube-system/network-attachment-definitions/ovs-dpdk-br0
    uid: 0dbc5098-dc09-449c-84ff-30c199471771
  spec:
    config: |
      {
        "cniVersion": "0.3.1",
        "type": "userspace",
        "name": "ovs-dpdk-br0",
        "kubeconfig": "/etc/cni/net.d/multus.d/multus.kubeconfig",
        "logFile": "/var/log/userspace-ovs-dpdk-br0.log",
        "logLevel": "debug",
        "host": {
          "engine": "ovs-dpdk",
          "iftype": "vhostuser",
          "netType": "bridge",
          "vhost": {
            "mode": "server"
          },
          "bridge": {
            "bridgeName": "br0"
          }
        },
        "container": {
          "engine": "ovs-dpdk",
          "iftype": "vhostuser",
          "netType": "interface",
          "vhost": {
            "mode": "client"
          }
        }
      }
kind: List
metadata:
  resourceVersion: ""
  selfLink: ""
2020-11-08T09:58:15.147748043Z 2020-11-08T09:58:15+0000 Generating Multus configuration file using files in /host/etc/cni/net.d...
2020-11-08T09:58:15.244760286Z 2020-11-08T09:58:15+0000 Attemping to find master plugin configuration, attempt 0
2020-11-08T09:58:20.642841380Z 2020-11-08T09:58:20+0000 Attemping to find master plugin configuration, attempt 5
2020-11-08T09:58:26.043785217Z 2020-11-08T09:58:26+0000 Attemping to find master plugin configuration, attempt 10
2020-11-08T09:58:31.442863156Z 2020-11-08T09:58:31+0000 Attemping to find master plugin configuration, attempt 15
2020-11-08T09:58:36.940894139Z 2020-11-08T09:58:36+0000 Attemping to find master plugin configuration, attempt 20
2020-11-08T09:58:42.342939193Z 2020-11-08T09:58:42+0000 Attemping to find master plugin configuration, attempt 25
2020-11-08T09:58:43.445072492Z 2020-11-08T09:58:43+0000 Using /host/etc/cni/net.d/01-kube-ovn.conflist as a source to generate the Multus configuration
2020-11-08T09:58:43.543692295Z 2020-11-08T09:58:43+0000 Config file created @ /host/etc/cni/net.d/00-multus.conf
2020-11-08T09:58:43.543764818Z { "cniVersion": "0.3.1", "name": "multus-cni-network", "type": "multus", "kubeconfig": "/etc/cni/net.d/multus.d/multus.kubeconfig", "delegates": [ { "name":"kube-ovn", "cniVersion":"0.3.1", "plugins":[ { "type":"kube-ovn", "server_socket":"/run/openvswitch/kube-ovn-daemon.sock" }, { "type":"portmap", "capabilities":{ "portMappings":true } } ] } ] }
2020-11-08T09:58:43.546082800Z 2020-11-08T09:58:43+0000 Entering sleep (success)...
withlin commented 3 years ago

I create another pod,which not annotations k8s.v1.cni.cncf.io/networks: mac-vlan-configthat pod is create successfully.

withlin commented 3 years ago

Link not found

cyclinder commented 2 years ago

hi @withlin

I have the same problem as you, Can you tell me if this problem is solved? thanks

withlin commented 2 years ago

hi @cyclinder It’s been a long time, I probably remember that the network card name is configured incorrectly.

cyclinder commented 2 years ago

I found some issues that reported the same problem, It seems to the network interface eth0 does not exist in the node

cat <<EOF | kubectl create -f -
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
  name: macvlan-conf
spec:
  config: '{
      "cniVersion": "0.3.0",
      "type": "macvlan",
      "master": "eth0",  // there
      "mode": "bridge",
      "ipam": {
        "type": "host-local",
        "subnet": "192.168.1.0/24",
        "rangeStart": "192.168.1.200",
        "rangeEnd": "192.168.1.216",
        "routes": [
          { "dst": "0.0.0.0/0" }
        ],
        "gateway": "192.168.1.1"
      }
    }'
EOF

but I edit master filed in the macvlan-conf and change the value eth0 to ens192, it works😄

withlin commented 2 years ago

the network card name is configured incorrectly.

@cyclinder Isn't this what i said

a-c-dream commented 3 months ago

@withlin @cyclinder What should master be set to? I have multiple nodes. Can I just set up any network card?

diegodurrod commented 4 weeks ago

@withlin @cyclinder What should master be set to? I have multiple nodes. Can I just set up any network card?

You can set a virtual interface with common name between all nodes or rename the current interface matching with MAC address.