title: How can I get CoreDNS to resolve on my Raspberry Pi Kubernetes cluster?
body: <p>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 <a href="https://blog.hypriot.com/post/setup-kubernetes-raspberry-pi-cluster/" rel="noreferrer">this guide from 2017</a>. 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.</p>
  <p>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 &quot;dial out&quot; to anything. As a test, I'm running the <code>arm32v7/buildpack-deps:latest</code> container in a pod. It pulls the image from Docker hub just fine. But when I shell into it and simply type <code>curl https://www.google.com</code> 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.</p>
  <p>Here are all the networking-related commands I've already run on each node:</p>
  <pre><code>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
  </code></pre>
  <p>I'm not entirely sure that the last two <code>iptables</code> commands did anything; I grabbed them from <a href="https://blog.hypriot.com/post/setup-kubernetes-raspberry-pi-cluster/#comment-3142210207" rel="noreferrer">the comment section of that guide I linked to earlier</a>. 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.</p>
  <p>What am I missing? I feel like I'm so close to having this cluster fully operational, but obviously I need functioning DNS!</p>
  <p>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 <code>curl -H &quot;Host: www.google.com&quot; 142.250.73.206</code>, 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.</p>