loft-sh / vcluster

vCluster - Create fully functional virtual Kubernetes clusters - Each vcluster runs inside a namespace of the underlying k8s cluster. It's cheaper than creating separate full-blown clusters and it offers better multi-tenancy and isolation than regular namespaces.
https://www.vcluster.com
Apache License 2.0
6.26k stars 398 forks source link

Error [FATAL] plugin/loop: Loop on microk8s #163

Closed gastonborba closed 2 years ago

gastonborba commented 2 years ago

Hello, thank you very much for your project, it's amazing. I'm using microk8s and dns plugin. When I create a virtual cluster I get this error:

❯ k get pods NAME READY STATUS RESTARTS AGE coredns-85cb69466-pn75z-x-kube-system-x-vcluster-1 0/1 CrashLoopBackOff 8 (2m47s ago) 18m vcluster-1-0 2/2 Running 0 19m

❯ k logs coredns-85cb69466-pn75z-x-kube-system-x-vcluster-1 .:53 [INFO] plugin/reload: Running configuration MD5 = 442b35f70385f5c97f2491a0ce8a27f6 CoreDNS-1.8.4 linux/amd64, go1.16.4, 053c4d5 [FATAL] plugin/loop: Loop (127.0.0.1:59658 -> :53) detected for zone ".", see https://coredns.io/plugins/loop#troubleshooting. Query: "HINFO 7325758017787539715.132383788276774473."

Would you have any idea how I can solve it? I read the documentation but I don't know how to fix it. Greetings.

FabianKramm commented 2 years ago

@gastonborba thanks for creating this issue! Seems as if your kubelet might be not correctly configured as indicated in this coredns troubleshooting guide: https://coredns.io/plugins/loop/

gastonborba commented 2 years ago

You were right!

The problem was that I had the loopback address 127.0.0.53 as a nameserver into /etc/resolv.conf.

I added the “real” resolv.conf (run/systemd/resolve/resolv.conf).

  1. I added this line at the end of the file /var/snap/microk8s/current/args/kubelet: --resolv-conf=/run/systemd/resolve/resolv.conf

  2. I restarted the cluster: microk8s stop microk8s start

And everthing works great! Thank you very much!