I've followed a number of online tutorials to set up a Kubernetes cluster on four Raspberry Pi 4s. I ended up using Flannel as the networking plugin as that seems to be the only one that actually works on RPi, with a pod network CIDR of 10.244.0.0/16, per this guide from 2017. Most everything is working... all of the base pods in the kube-system namespace are running/healthy, and I can pull down images and launch new containers. At first I wasn't able to get any pod logs, but that was quickly remedied by opening up port 10250 on each node.
But there still seems to be a problem DNS resolution. I should clarify that DNS resolution on the hosts clearly does work, as the cluster is able to download any container image I specify. But once a container is running, it isn't able to "dial out" to anything. As a test, I'm running the arm32v7/buildpack-deps:latest
container in a pod. It pulls the image from Docker hub just fine. But when I shell into it and simply type curl https://www.google.com
it hangs before eventually timing out. And the same is true of any pod I launch that needs to interact with the external Internet: they hang and hang and hang.
Here are all the networking-related commands I've already run on each node:
sudo iptables -P FORWARD ACCEPT
sudo iptables -A FORWARD -i cni0 -j ACCEPT
sudo iptables -A FORWARD -o cni0 -j ACCEPT
sudo ufw allow ssh
sudo ufw allow 443 # can't remember why i ran this one
sudo ufw allow 6443
sudo ufw allow 8080 # this one might not be strictly necessary, either
sudo ufw allow 10250
sudo ufw default allow routed
sudo ufw enable
I'm not entirely sure that the last two iptables
commands did anything; I grabbed them from the comment section of that guide I linked to earlier. I know that guide assumes one is using kube-dns but it's also 3 years old so I am using the (newer) default, coredns, instead.
What am I missing? I feel like I'm so close to having this cluster fully operational, but obviously I need functioning DNS!
UPDATE: I know that it's a DNS problem, and not general Internet connectivity, for two reasons: (1) the cluster itself can pull down any image I specify from Dockerhub, and (2) when I shell into a running container that has curl and execute curl -H "Host: www.google.com" 142.250.73.206
, it successfully returns the Google homepage HTML. But as mentioned if I try and do my earlier curl command using the hostname, that times out.
sudo kubeadm init --token-ttl=0 --pod-network-cidr=10.244.0.0/16 --apiserver-advertise-address=192.168.1.194
(because 192.168.1.194 is the local IP of my master node RPI). Based on what that comment says, it sounds like I need to add an extra option to that:--cluster-dns=100.64.0.10
. Does that sound correct to you @ofirule? Or should I use my 192.168.1.194 IP instead? – Scournetwork-cidr
and probably goes to 10.244.0.10 , but this is something you have to check. – Divergencydig @10.244.0.10 google.com
it still times out. – Scourcluster-dns=8.8.8.8
would work. But this is not the kubernetes way – Divergencykubectl get pods -n kube-system
) – Flesher-o wide
to your command to see more I can tell you that the two pods were assigned internal IPs 10.244.0.4 and 10.244.0.5, respectively. And they seem stable - they haven't restarted. They're both running on the master node. Unfortunately if I try runningdig @10.244.0.4 google.com
from inside a container that times out too :( – Scour