Pod creation stuck at ContainerCreating state in 3 node k8s cluster

Asking for help? Comment out what you need so we can get more information to help you!

Cluster information:

Kubernetes version: v1.18.0
Cloud being used: (put bare-metal if not on a public cloud) : AWS
Installation method: Kubeadm init
Host OS: Ubuntu 16
CNI and version:0.3.0
CRI and version:

I am getting the below error while creating nginx pod after cluster build

Events:
Type Reason Age From Message


Normal Scheduled 9m10s default-scheduler Successfully assigned default/nginx to ip-172-31-7-82
Warning FailedCreatePodSandBox 5m29s kubelet Failed to create pod sandbox: rpc error: code = Unknown desc = failed to set up sandbox container “a87b2571adaccf5ce580808b59db7e2a7baed3584fd2873c2489dec081264874” network for pod “nginx”: networkPlugin cni failed to set up pod “nginx_default” network: netplugin failed with no error message
Normal SandboxChanged 107s (x2 over 5m28s) kubelet Pod sandbox changed, it will be killed and re-created.
Warning FailedCreatePodSandBox 107s kubelet Failed to create pod sandbox: rpc error: code = Unknown desc = failed to set up sandbox container “8110db3db3dd6fbb84eb2ca076dc5cfa382040c383f6a98a1477428878def803” network for pod “nginx”: networkPlugin cni failed to set up pod “nginx_default” network: netplugin failed with no error message

I have tried in several kubernetes version by creating cluster multiple times with AWS fresh ec2 instances.

Kindly help me how to fix this issue.

You can format your yaml by highlighting it and pressing Ctrl-Shift-C, it will make your output easier to read.

we had a similar problem with our cluster when we first built it last year. there is either a conflict with your CNI (e.g. flannel or other), or you still have selinux turned on. Also, what does your cri.d file look like? Here is a snipped from a scripted build I did for our platform:

> # Setup required sysctl params, these persist across reboots.
> cat > /etc/sysctl.d/99-kubernetes-cri.conf <<EOF
> net.bridge.bridge-nf-call-iptables  = 1
> net.ipv4.ip_forward                 = 1
> net.bridge.bridge-nf-call-ip6tables = 1
> EOF