Clear out additionals to avoid malformed edns responses
In some instances the Ubuntu 18.04 StubResolver in systemd sends edns queries per default (bug here).
dns2/node-dns can't handle those.
When responding to edns queries, minikube-ingress-dns includes the additionals records with the OPT RRs, this results in malformed DNS responses.
This means that systemd-resolved considers the replies from the server as invalid, and doesn't forward the answer records to the client.
This change simply clears out the additionals field in the response, which is a valid response when the OPT RR is not understood: https://tools.ietf.org/html/rfc6891#section-6.1.2
Any OPTION-CODE values not understood by a responder or requestor MUST be ignored.
So! All of the above might seem minor, but we are just getting to the good part. The fix means that this:
sudo resolvconf -u
systemctl disable --now resolvconf.service
is no longer necessary. We can now actually use systemd-resolved as it was intended:
sudo systemd-resolve --interface vboxnet0 --set-dns $(minikube ip) --set-domain kube
(adjust IF & domain to match ofc.)
A permanent config for the above would be:
[Match]
Name=vboxnet0
[Network]
DNS=192.168.99.100
Domains=kube
Placed in /etc/systemd/network/minikube.network, followed by a sudo systemctl restart systemd-networkd.
Note that this restart kills the minikube network (at least on virtualbox), so minikube needs to be restarted as well.
Adding the config to /etc/systemd/network/ instead of /etc/systemd/resolved.conf.d/ allows us to tie the config to a specific network interface.
The settings can be verified with systemd-resolve --status vboxnet0.
This change should be backwards compatible with the old way of configuring host DNS.