I have a single node k3s cluster deployed on a VM that I installed the Multus plugin on following the guide on https://docs.k3s.io/networking/multus-ipams. This cluster uses Weavenet as the CNI. When I try testing it with the following pod deployment and Network Attachment Definition the plugin ignores the pod.
Network Attachment Definition:
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: macvlan-conf
namespace: default
spec:
config: |-
{
"cniVersion": "0.3.1"
"type": "ipvlan",
"master": "enp3s0",
"ipam": {
"type": "static",
"routes": [
{ "dst": "10.22.0.0", "gw": "10.22.125.1"}
]
}
}
pod:
apiVersion: v1
kind: Pod
metadata:
name: sample-pod
namespace: default
annotations:
k8s.v1.cni.cncf.io/networks: |
[{
"name": "macvlan-conf",
"namespace": "default",
"mac": "c6:5e:a4:8e:7a:59",
"ips": ["10.22.125.202"]
}]
spec:
containers:
- name: sample-pod
image: alpine
command: ["/bin/sh", "-c", "trap: TERM INT; sleep infinity & wait"]
The event log for the pod is:
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 18s default-scheduler Successfully assigned default/sample-pod to eoa-shtl02
Normal Pulling 18s kubelet Pulling image "alpine"
Normal Pulled 18s kubelet Successfully pulled image "alpine" in 242.842931ms
Normal Created 18s kubelet Created container sample-pod
Normal Started 18s kubelet Started container sample-pod
My first thought was that there might be something wrong with the configuration since the cluster uses Weavenet, but the default would be flannel, so I went to etc/cni/net.d to check 00-multus.conf, but there was no 00-multus.conf there to begin with. I have tried 2 different config files that look like this
87-podman:
{
"capabilities": {"portMappings": true},
"cniVersion": "0.3.1",
"logLevel": "verbose",
"logToStderr": true,
"name": "multus-cni-network",
"clusterNetwork": "host/etc/cni/net.d/87-podman.conflist",
"type": "multus-shim"
}
10-weave:
{
"capabilities": {"portMappings": true},
"cniVersion": "0.3.1",
"logLevel": "verbose",
"logToStderr": true,
"name": "multus-cni-network",
"clusterNetwork": "host/etc/cni/net.d/10-weave.conflist",
"type": "multus-shim"
}
For both cases when I ran my pods it just ends up being stuck in the container creating step with the following event log:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 2m13s default-scheduler Successfully assigned default/sample-pod to eoa-shtl02
Warning FailedCreatePodSandBox 74s kubelet Failed to create pod sandbox: rpc error: code = Unknown desc = failed to setup network for sandbox "cc6ca7b7d3d8703dd37b3bcb9c6c18fdd94ea482e2ba959c2738db3501f44a02": CmdAdd (shim): timed out waiting for the condition
Warning FailedCreatePodSandBox 2s kubelet Failed to create pod sandbox: rpc error: code = Unknown desc = failed to setup network for sandbox "1434672869e95a7c32e662ca25ede1b102ff1b155418a86cbfebf2c96518195d": CmdAdd (shim): timed out waiting for the condition
and it just keeps repeating the warning message if I let it stay on. As a side note I had the installation from here https://github.com/k8snetworkplumbingwg/multus-cni/tree/master on this system first when I was first setting it up before I knew k3s had a different method of installing Multus and it did not work either.
Mudrock is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.