Context
I installed Docker
following this instruction on my Ubuntu 18.04 LTS (Server)
and later on Kubernetes
followed via kubeadm
. After initializing (kubeadm init --pod-network-cidr=10.10.10.10/24
) and joining a second node (I got a two node cluster for the start) I cannot get my coredns as well as the later applied Web UI (Dashboard) to actually go into status Running.
As pod network I tried both, Flannel (kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/2140ac876ef134e0ed5af15c65e414cf26827915/Documentation/kube-flannel.yml
) and Weave Net - Nothing changed. It still shows status ContainerCreating, even after hours of waiting:
Question
Why doesn't the container creation work as expected and what might be the root cause for this? And most importantly: How do I solve this?
Edit
Summing up my answer below, here are the reasons why:
- Docker used
cgroups
instead ofsystemd
- I did not configure
iptables
correctly - I used a wrong
kubeadm init
since flannels standard-yaml requires--pod-network-cidr
to be10.244.0.0/16
Since answering this questions took me a lot of time, I wanted to share what got me out of this. There might be some more code than necessary, but I also want this to be in one place if I or someone else has to redo all steps.
First it all started with Docker...
I figured out that it presumably all started with the way I installed Docker. Following the linked online-instructions I used
sudo apt-get install docker.io
in order to install Docker and used it withcgroups
by doingsudo usermod -aG docker $USER
.Well, taking a look at the official instructions from Kubernetes this was a mistake:
systemd
is the recommended way to go!So I completly purged all I ever did with docker by following these great instructions from Mayur Bhandare:
Afterwards I installed reinstalled the official way (keep in mind that this might change in the future):
Note that this explicitly uses
systemd
!... and then it went on with Flannel...
Above I wrote my
sudo kubeadm init
was done with--pod-network-cidr=10.10.10.10/24
since the latter was the IP of my master. Well, as pointed out here not using the official recommended--pod-network-cidr=10.244.0.0/16
results in an error for example usingkubectl proxy
or the container-creation when using the providedkubectl apply -f https://raw.githubusercontent.com/coreos/flannel/2140ac876ef134e0ed5af15c65e414cf26827915/Documentation/kube-flannel.yml
. This is due to the fact that10.244.0.0/16
is hard-linked in the.yaml
and, hence, mandatory - Or you just change it in the.yaml
.In order to get rid of the false configuration I did a full reset. This can be achieved using
sudo kubeadm reset
and by deleting the config withsudo rm -r ~/.kube/config
. Anyhow, since I screwed it so much, I did a full reset by uninstalling and reinstallingkubeadm
and making sure it did useiptables
this time (which I also forgot to do before...).Here is a nice link how to fully uninstall all kubeadm-parts.
For the sake of completeness, here is the reinstall as well:
... and finally it worked!
After the clean reinstallation I did the following:
And then be astouned by the result:
On a site note: This also resolved the
/run/flannel/subnet.env: no such file or directory
-error I encountered prior to these steps when describing the uncreated coredns.