Multus - pod stuck in terminating state

There are situations that pods in kubernetes might need additional network interfaces. A typical use case might be kubevirt or special applications that need more network throughput and might make use of SR-IOV adapters.

In any case you will typically use multus CNI for this.

This post adresses an edge case that might happen when you did possibly an invalid configuration on the network config and the pod cannot start nor stop.

If you describe the pod, it will show you something like:

error killing pod: failed to "KillPodSandbox" for "981bf6f9-cac2-43d7-860e-2a921650978e" with KillPodSandboxError: "rpc error: code = Unknown desc = failed to destroy network for sandbox "8bff599ad441f4762f4b7d1e8a92739ff33d23cdd2517e936649a0da9641d6a1": plugin type="multus" name="multus-cni-network" failed (delete): delegateDel: error invoking DelegateDel - "vlan": error in getting result from DelNetwork: no plugin name provided"
status of the pod

The easy fix to get the pod terminated properly is to open the pod spec and remove the multus related annotation k8s.v1.cni.cncf.io/networks.

apiVersion: v1
kind: Pod
metadata:
  annotations:
    cni.projectcalico.org/containerID: 8bff599ad441f4762f4b7d1e8a92739ff33d23cdd2517e936649a0da9641d6a1
    cni.projectcalico.org/podIP: ""
    cni.projectcalico.org/podIPs: ""
    k8s.v1.cni.cncf.io/networks: '[{"name":"br0-vlan2110","namespace":"vms","interface":"pod37a8eec1ce1"}]'
    kubectl.kubernetes.io/default-container: compute
pod spec excerpt

Just remove the annotation and the webhook will allow the deletion - problem solved.