Hello everyone. I'm trying to deploy a k8s cluster using `kubeadm` with `contain . . .

Timekiller:
Hello everyone. I’m trying to deploy a k8s cluster using kubeadm with containerd as the container runtime on an AWS EC2 instance with Amazon Linux 2 and coming across the following problem:

I’ve been following along through this demo lesson https://kodekloud.com/topic/demo-deployment-with-kubeadm/ with the documentation here: https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/

Everything has been going well so far but I seem to be stuck on my CoreDNS pods being in ContainerCreating state:

NAME                                                   READY   STATUS              RESTARTS       AGE
coredns-6d4b75cb6d-27hwl                               0/1     ContainerCreating   0              19m
coredns-6d4b75cb6d-rdst6                               0/1     ContainerCreating   0              19m

Looking at the event logs it seems like this issue is failed to find network info for sandbox which looks similar to what @Abdullah Naeem is experiencing.

Events:
  Type     Reason                  Age                 From               Message
  ----     ------                  ----                ----               -------
  Normal   Scheduled               21m                 default-scheduler  Successfully assigned kube-system/coredns-6d4b75cb6d-27hwl to ip-172-31-28-82.ec2.internal
  Warning  FailedCreatePodSandBox  20m                 kubelet            Failed to create pod sandbox: rpc error: code = Unknown desc = failed to setup network for sandbox "ccd66db5747fbb1b0d170c979f4dece6b18a024dbe0b464c5a7c684aeb4bf01c": failed to find network info for sandbox "ccd66db5747fbb1b0d170c979f4dece6b18a024dbe0b464c5a7c684aeb4bf01c"
  Warning  FailedCreatePodSandBox  57s (x81 over 18m)  kubelet            (combined from similar events): Failed to create pod sandbox: rpc error: code = Unknown desc = failed to setup network for sandbox "e14e36d7fbd228f38c12415872d16b800a30458c089c89ff77f40066aa6e94ef": failed to find network info for sandbox "e14e36d7fbd228f38c12415872d16b800a30458c089c89ff77f40066aa6e94ef"

Any clues? I can provide an exact log of every single step/command taken to reach this point, as I’m provisioning the VM with IaC tools - rebuilding the VM always results in this same result, so I’m pretty sure I missed something somewhere.

Timekiller:
Also willing to hop on a call with someone and display the whole setup and the issue in great detail :slightly_smiling_face:

Matthew Robinson:
What network CNI layer are you using?

Timekiller:
Oh hey Matthew! Fancy meeting you here :slightly_smiling_face:

The same one being used in the demo: https://www.weave.works/docs/net/latest/kubernetes/kube-addon/

Timekiller:
Does weave net expect the docker container engine? I just noticed this in the weave logs:

INFO: 2022/06/01 05:22:22.457418 Command line options: map[conn-limit:200 datapath:datapath db-prefix:/weavedb/weave-net docker-api: expect-npc:true http-addr:127.0.0.1:6784 ipalloc-init:consensus=0 ipalloc-range:10.32.0.0/12 metrics-addr:0.0.0.0:6782 name:2e:59:61:6c:f0:bd nickname:ip-172-31-28-82.ec2.internal no-dns:true no-masq-local:true port:6783]

I’m using containerd

Matthew Robinson:
I just had a bit of a Google and it looks like a few people are having issues with containerd and WeaveNet

Matthew Robinson:
https://serverfault.com/questions/1100808/pod-coredns-stuck-in-containercreating-state-with-weave-on-k8s

Matthew Robinson:
https://github.com/containerd/containerd/issues/6921

Timekiller:
Yeah, I’ve seen that first one.

Timekiller:
Any alternative CNI you’d recommend? There are a bunch

Timekiller:
> https://github.com/containerd/containerd/issues/6921
I think you found it!

Timekiller:
I’m using the same version of containerd as well 1.6.4

Matthew Robinson:
When I started playing I used flannel as it is probably the simplest of the CNIs

Timekiller:
That’s an excellent suggestion. Thank you so much! I’ll do that next :slightly_smiling_face:

Matthew Robinson:
If I remember correctly flannel can’t do some things, network policies rings a bell

Timekiller:
That’s good to keep in mind! I can always switch later if flannel works

Matthew Robinson:
I’m mostly using EKS at the moment with the AWS VPC CNI which I wouldn’t recommend for experimenting

Timekiller:
No worries, I’ll stay away from EKS! Still planning to move to a more managed solution later on after I’m done playing with kubeadm setup

Timekiller:
That issue is now solved! Thanks again Matthew! :slightly_smiling_face:

unnivkn:
Hi @Timekiller the root cause here is while you install kubeadm you might have passed --pod-network-cidr= <some IP Rang>. So this Ip range should match with the default IP range of the CNI you are trying to install. For eg: weavenetwork use 10.x.x.x Ip range & Flannel uses 172.x.x.x IP range. So if you use Flannel Ip range(eg: 172.1.0.22) along with kubadm command & try to install weave network CNI you may get the error, which you already encountered above. fyr: