Kubeadm init not in working in Windows Subsystem for Linux Ubuntu


#1

Hi,

I’m currently trying out kubeadm instead of minikube since I’m trying to build a multi node environment. However, I’m stuck at kubeadm init. When I run the command, i got the following errors:

CGROUPS_CPU: missing
CGROUPS_CPUACCT: missing
CGROUPS_CPUSET: missing
CGROUPS_DEVICES: enabled
CGROUPS_FREEZER: missing
CGROUPS_MEMORY: missing
error execution phase preflight: [preflight] Some fatal errors occurred:
[ERROR SystemVerification]: failed to parse kernel config: unable to load kernel module: “configs”, output: “modprobe: ERROR: …/libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file ‘/lib/modules/4.4.0-17134-Microsoft/modules.dep.bin’\nmodprobe: FATAL: Module configs not found in directory /lib/modules/4.4.0-17134-Microsoft\n”, err: exit status 1
[ERROR SystemVerification]: failed to get docker info: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
[ERROR SystemVerification]: missing cgroups: cpu cpuacct cpuset freezer memory

Can kubeadm works in this kind of environment? I mean Windows Subsystem for Linux.

Regards,
Dexter


#2

I’ve had similar issues with the WSL, things don’t always behave as expected. To get docker working you have to expose the docker port, without TLS in Windows (docker settings) and then tell Docker in the WSL where to go.

That might get it kind of working though the missing CGROUP stuff might cause you further issues and you’re also exposing Docker via non TLS which isn’t ideal. https://nickjanetakis.com/blog/setting-up-docker-for-windows-and-wsl-to-work-flawlessly

I find for things like that a full vm or Vagrant works best.

Here’s a nice guide for getting kubeadm up and running in Vagrant. https://medium.com/@lizrice/kubernetes-in-vagrant-with-kubeadm-21979ded6c63


#3

Thanks for your quick reply!!!
Working fine so far with kubernetes installed but when i try to issue the command kubectl get nodes it says localhost:8080 connection refused.

How can i fix this?


#4

That usually means your kubeconfig is not set correctly. If you’ve just run kubeadm, the generated config likely hasn’t been copied to your home directory yet.
On a normal unix/linux system you’d do the following:

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config