k3s: Search domain stops DNS from working properly
Environmental Info:
| Name | Status | Roles | Age | Version | Internal-IP | External-IP | OS-Image | Kernel-Version |
|---|---|---|---|---|---|---|---|---|
| k3s-master-01 | Ready | control-plane,etcd,master | 1h | v1.20.0+k3s2 | 10.0.0.52 | <none> | Ubuntu 20.04.1 LTS | 5.4.0-60-generic (x86_64) |
| k3s-master-02 | Ready | control-plane,etcd,master | 1h | v1.20.0+k3s2 | 10.0.0.53 | <none> | Ubuntu 20.04.1 LTS | 5.4.0-60-generic (x86_64) |
| k3s-master-03 | Ready | control-plane,etcd,master | 1h | v1.20.0+k3s2 | 10.0.0.54 | <none> | Ubuntu 20.04.1 LTS | 5.4.0-60-generic (x86_64) |
Describe the bug:
DNS Lookups will always bring up the same IP address.
This happens the search domain and a wild card record for a subdomain is set. Then every domain lookup will fail and (I think) be resolved like this: google.com.mydomain.com
Steps To Reproduce:
ssh -t k3s-master-01 '
sudo hostnamectl set-hostname k3s-master-01.mydomain.com
sudo rm -f /etc/resolv.conf
echo -e "nameserver 10.0.0.1\nsearch mydomain.com" | sudo tee /etc/resolv.conf
export K3S_TOKEN="d0f23ad0d814bc489a00e111ec5970c7368130be963bfb4"
export INSTALL_K3S_EXEC="server --cluster-init --secrets-encryption \
--tls-san=cluster.mydomain.com \
--node-name k3s-master-01
--disable traefik --disable servicelb --disable local-storage"
export INSTALL_K3S_SYMLINK="skip"
export INSTALL_K3S_CHANNEL="stable"
sudo curl -SsL "https://share.mydomain.com/k3s" -o /usr/local/bin/k3s #Just to bypass the slow github cdn in my area
sudo chmod +x /usr/local/bin/k3s
curl -SsfL "https://get.k3s.io" | sudo --preserve-env=K3S_TOKEN --preserve-env=INSTALL_K3S_EXEC --preserve-env=INSTALL_K3S_SYMLINK --preserve-env=INSTALL_K3S_CHANNEL sh -
'
Set *.mydomain to an IP
*.mydomain.com. IN A 10.0.0.150
cluster.mydomain.com. IN A 10.0.0.50
k3s-master-01.mydomain.com. IN A 10.0.0.52
k3s-master-02.mydomain.com. IN A 10.0.0.53
k3s-master-03.mydomain.com. IN A 10.0.0.54
Expected behavior:
[modzilla@fedora33 k3s-cluster]$ kubectl run -i -t alpine --image=alpine --restart=Never
If you don't see a command prompt, try pressing enter.
/ # ping google.com
PING google.com (172.217.16.78): 56 data bytes
64 bytes from 172.217.16.78: seq=0 ttl=118 time=3.877 ms
^C
--- google.com ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 3.877/3.877/3.877 ms
Actual behavior:
[modzilla@fedora33 k3s-cluster]$ kubectl run -i -t alpine --image=alpine --restart=Never
If you don't see a command prompt, try pressing enter.
/ # ping google.com
PING google.com (10.0.0.150): 56 data bytes
^C
--- google.com ping statistics ---
2 packets transmitted, 0 packets received, 100% packet loss
Additional context / logs: I’m a newbie, so tell me what you need!
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 22 (8 by maintainers)
@modzilla99 Take note of the busy box version these troubleshooting docs DNS use. If your issue isn’t with the Alpine behavior, you may be encountering something like this, which has been an outstanding issue with the suggested resolution of NodeLocal DNS. Hopefully one of these points you in the right direction.