mmumshad / kubernetes-the-hard-way

Bootstrap Kubernetes the hard way on Vagrant on Local Machine. No scripts.
Apache License 2.0
4.7k stars 4.54k forks source link

Error with loopback CNI missing: Provisioning networking should use latest version #40

Closed Nordes closed 2 years ago

Nordes commented 5 years ago

(How to fix is given after the error description)

Error:

Events:
  Type     Reason                  Age                   From               Message
  ----     ------                  ----                  ----               -------
  Normal   Scheduled               13m                   default-scheduler  Successfully assigned kube-system/coredns-69cbb76ff8-q2zgf to worker-1
  Warning  FailedCreatePodSandBox  13m                   kubelet, worker-1  Failed create pod sandbox: rpc error: code = Unknown desc = [failed to set up sandbox container "9d371fb41ba4963cea4081ace2b6590d501def894d06098c2f866241857386d1" network for pod "coredns-69cbb76ff8-q2zgf": NetworkPlugin cni failed to set up pod "coredns-69cbb76ff8-q2zgf_kube-system" network: failed to find plugin "loopback" in path [/opt/cni/bin], failed to clean up sandbox container "9d371fb41ba4963cea4081ace2b6590d501def894d06098c2f866241857386d1" network for pod "coredns-69cbb76ff8-q2zgf": NetworkPlugin cni failed to teardown pod "coredns-69cbb76ff8-q2zgf_kube-system" network: failed to find plugin "portmap" in path [/opt/cni/bin]]
  Normal   SandboxChanged          3m34s (x48 over 13m)  kubelet, worker-1  Pod sandbox changed, it will be killed and re-created.

How to fix

Instead of using version 0.7.5, we should be using the latest version:

wget https://github.com/containernetworking/plugins/releases/download/v0.8.2/cni-plugins-linux-amd64-v0.8.2.tgz
sudo tar -xzvf cni-plugins-linux-amd64-v0.8.2.tgz --directory /opt/cni/bin/

Reason

This is because of the next command which takes the "latest" version.

kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"

The 0.7.5 does not contains the loopback and some other stuff.

gerrywastaken commented 4 years ago

Thank you so much for posting this fix as I ran into the same issue. I only wish it was fixed in the project.

raihanchdy commented 4 years ago

I followed same doc. Nodes are discovered by the master also. weave setup is not happening and kube-api is throwing error "http: TLS handshake error from, bad, remote error: tls: bad certificate"

fireflycons commented 2 years ago

Hi @Nordes @gerrywastaken

We have now merged a major change to bring this to v1.24. Many issues have been addressed as part of the upgrade. I realise this is a very old issue, however I was tasked with closing off all old issues following the upgrade. Please try it now and feel free to raise further issues.

Thanks.