Calico for policy and flannel not working in kubeadm (k8s -v1.22.3) , calico-kube-controllers are not ready (CrashLoopBackOff)

11/4/2021

Done k8s cluster setup on my Ubuntu machine using kubeadm with one master and single worker node. For the CNI, I am using aka Canal. when deploying got CrashLoopBackOff for calico-kube-controllers
have done these steps:-

   sudo kubeadm init --pod-network-cidr=192.168.18.246/16
   kubeadm join 192.168.18.246:6443 --token xxxxx.xxxxx --discovery-token-ca- 
   cert-hash sha256:xxxxxxxxxxxb403d838a14298baxxxxxxx37eeee95c
   curl https://docs.projectcalico.org/manifests/canal.yaml -O
   kubectl apply -f canal.yaml 

the calico pod events are given below

  Type     Reason                  Age                From               Message
  ----     ------                  ----               ----               -------
  Normal   Scheduled               104s               default-scheduler  Successfully assigned kube-system/calico-kube-controllers-75f8f6cc59-nlsqf to node1
  Warning  FailedCreatePodSandBox  99s                kubelet            Failed to create pod sandbox: rpc error: code = Unknown desc = failed to set up sandbox container "02b78d610a0047ee6eb6d6ee66cdd486e8b25a17db25fa8fbdb93c5fe9586f41" network for pod "calico-kube-controllers-75f8f6cc59-nlsqf": networkPlugin cni failed to set up pod "calico-kube-controllers-75f8f6cc59-nlsqf_kube-system" network: open /run/flannel/subnet.env: no such file or directory
  Warning  FailedCreatePodSandBox  96s                kubelet            Failed to create pod sandbox: rpc error: code = Unknown desc = [failed to set up sandbox container "e83b45f447ca0289720cd2dc4947358aa56238725ee1ad6edef5cbf982230239" network for pod "calico-kube-controllers-75f8f6cc59-nlsqf": networkPlugin cni failed to set up pod "calico-kube-controllers-75f8f6cc59-nlsqf_kube-system" network: error getting ClusterInformation: resource does not exist: ClusterInformation(default) with error: clusterinformations.crd.projectcalico.org "default" not found, failed to clean up sandbox container "e83b45f447ca0289720cd2dc4947358aa56238725ee1ad6edef5cbf982230239" network for pod "calico-kube-controllers-75f8f6cc59-nlsqf": networkPlugin cni failed to teardown pod "calico-kube-controllers-75f8f6cc59-nlsqf_kube-system" network: error getting ClusterInformation: resource does not exist: ClusterInformation(default) with error: clusterinformations.crd.projectcalico.org "default" not found]
  Normal   SandboxChanged          83s (x3 over 99s)  kubelet            Pod sandbox changed, it will be killed and re-created.
  Warning  BackOff                 54s (x2 over 56s)  kubelet            Back-off restarting failed container
  Normal   Pulled                  43s (x3 over 80s)  kubelet            Container image "docker.io/calico/kube-controllers:v3.20.2" already present on machine
  Normal   Created                 42s (x3 over 79s)  kubelet            Created container calico-kube-controllers
  Normal   Started                 42s (x3 over 79s)  kubelet            Started container calico-kube-controllers
  Warning  Unhealthy               34s (x9 over 79s)  kubelet            Readiness probe failed: Failed to read status file /status/status.json: unexpected end of JSON input
-- Muhammed sufiyan PK
calico
docker
flannel
kubeadm
kubernetes

0 Answers