microk8s install problem "cni plugin not initialized"

12/29/2020

Upgraded to PC to ubuntu 20.04 and having problems re-installing microk8s (1.19 and 1.20 have the same issue on my PC).

starting fresh to demo problem

snap remove microk8s

Following instructions on Install MicroK8s

sudo snap install microk8s --classic --channel=1.19

result:

microk8s (1.19/stable) v1.19.5 from Canonical✓ installed

Step: Join the group

sudo usermod -a -G microk8s $USER
sudo chown -f -R $USER ~/.kube
su - $USER

Step: Check the status

microk8s status --wait-ready

Result: Hangs forever

Figure out what is going on:

microk8s inspect

The tar files contain lots of

Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:Network plugin returns error: cni plugin not initialized

dial tcp 127.0.0.1:16443: connect: connection refused

Any suggestions would be appreciated.

-- grabbag
kubernetes
microk8s

2 Answers

11/29/2021

Check your /etc/ hosts file there should be these lines

127.0.0.1 localhost 127.0.1.1 name you servers

It's funny in microk8s 1.18 all works good)

-- Stanislav G.
Source: StackOverflow

12/30/2020

I had the same issue on a new Ubuntu 20.04.1 Server install and following the same instructions... e.g.

sudo snap install microk8s --classic --channel=1.19

What worked for me was using the 1.18 channel

sudo snap remove microk8s
sudo snap install microk8s --classic --channel=1.18/stable

And then refreshing to 1.19 once microk8s 1.18 became ready...

sudo snap refresh microk8s --classic --channel=1.19/stable

Don't ask me why this worked but it did.

-- dustymugs
Source: StackOverflow