Open segevfiner opened 4 years ago
Hey @segevfiner by default minikube has coredns running:
$ kubectl get po -A
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system coredns-66bff467f8-6wtb9 1/1 Running 0 34s
is this what you're looking for?
That one is for the cluster internal DNS. Handling DNS for services and pods inside the cluster.
The external DNS setup referenced is for setting another CoreDNS server for out of cluster DNS, emulating what you get with Kubernetes external DNS in peoduction Kubernetes deployments, where it configures DNS providers like AWS Route53. Similar to what the ingress-dns
addon achieves but with the benefits mentioned in the description.
I hope this clarifies what this is about.
@segevfiner thanks for clarifying! Would you be interested in contributing this addon?
If so, documentation can be found here: https://minikube.sigs.k8s.io/docs/contrib/addons/
Looking into this further, there are some things to iron out first:
First, the setup in the tutorial there is not the cleanest, I tried to make a simpler one here using just helm to get started:
helm repo add stable https://kubernetes-charts.storage.googleapis.com
helm repo add bitnami https://charts.bitnami.com/bitnami
helm upgrade -i etcd-operator stable/etcd-operator --set customResources.createEtcdClusterCRD=true
helm upgrade -i coredns stable/coredns -f coredns-values.yaml
helm upgrade -i external-dns bitnami/external-dns --set provider=coredns --set coredns.etcdEndpoints=http://etcd-cluster-client:2379
coredns-values.yaml
(Yes, had to copy that entire large block from the values.yaml
cause it's an array 🤷♂️ )
And after it is all up and running, I can create some LoadBalancer
service and annotate it:
kubectl create deployment nginx --image nginx
kubectl expose deployment nginx --port 80 --type LoadBalancer
kubectl annotate service nginx "external-dns.alpha.kubernetes.io/hostname=nginx.test"
Start minikube tunnel
so the LoadBalancer
service gets an IP and is accessible.
Get the CoreDNS IP & port:
export COREDNS_PORT=$(kubectl get --namespace default -o jsonpath="{.spec.ports[0].nodePort}" services coredns-coredns)
export COREDNS_IP=$(kubectl get nodes --namespace default -o jsonpath="{.items[0].status.addresses[0].address}")
And query it:
dig @$COREDNS_IP -p $COREDNS_PORT nginx.test
Problems:
hostNetwork
like ingress-dns
uses or hostPort
, or some other proxy shenanigans.Host configuration afterwards will be similar to ingress-dns
where the instructions can probably be expanded with information for more operating systems or possibly automated at some point (Being careful not to destroy the host...)
I am using minikube w/ kvm. I noticed that dnsmasq was setup for minikube, but saw no entries. It would be nice to have external-dns use dnsmasq.
That dnsmasq is likely listening on a localhost address and is a caching forwarding resolver for the VM itself, rather than a DNS server intended to be queried externally. (Serves the same purpose as systemd-resolved on newer distros). On most distros that use dnsmasq like so, installing dnsmasq directly would often install a second copy that is listening on the interfaces directly and is meant to be configured for external queries, separate from the one listening on localhost.
Also note that such a caching resolver on Linux often doesn't listen on 127.0.0.1 but rather on some other localhost address, such as 127.0.1.1
on Ubuntu, as to allow another DNS server to bind to 127.0.0.1
.
Besides that, the upstream external-dns project has no support for using dnsmasq as the DNS server.
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale
.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close
.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle stale
/remove-lifecycle stale
@segevfiner are you still interested to make this happen ? I would be happy to accept any PR that adds this feature.
I came here after setting up ingress-dns
, and wanting to change the domain (from *.test.
to *.mycorp.example.com
). I realized that minikube-ingress-dns, which is used by the ingress-dns
extension, is a very small and rather inactive Node.js project. CoreDNS appears to be a much more stable, and better backed up candidate. Please make this happen!
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
lifecycle/stale
is appliedlifecycle/stale
was applied, lifecycle/rotten
is appliedlifecycle/rotten
was applied, the issue is closedYou can:
/remove-lifecycle stale
/lifecycle rotten
/close
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
lifecycle/stale
is appliedlifecycle/stale
was applied, lifecycle/rotten
is appliedlifecycle/rotten
was applied, the issue is closedYou can:
/remove-lifecycle rotten
/close
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle rotten
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
lifecycle/stale
is appliedlifecycle/stale
was applied, lifecycle/rotten
is appliedlifecycle/rotten
was applied, the issue is closedYou can:
/reopen
/remove-lifecycle rotten
Please send feedback to sig-contributor-experience at kubernetes/community.
/close
@k8s-triage-robot: Closing this issue.
I will try to come up with a solution. I'm working on a PR for an external dns addon, not sure if I want to use CoreDNS though. Maybe bind in combination with RFC2136 is a better, more basic alternative that doesn't rely on another etcd.
@medyagh Would you mind reopening this issue?
@denniseffing: You can't reopen an issue/PR unless you authored it or you are a collaborator.
/assign
I will try to come up with a solution. I'm working on a PR for an external dns addon, not sure if I want to use CoreDNS though. Maybe bind in combination with RFC2136 is a better, more basic alternative that doesn't rely on another etcd.
@medyagh Would you mind reopening this issue?
The CoreDNS via etcd is just what was/is currently available in the official external-dns for such a setup. Yeah, it's a bit clumsy. My PR, besides various documentation and fixes that I listed, and it likely becoming stale by now, is mostly complete except that I couldn't figure out how to get the host IP since for DNS I have to explicitly bind to the external interface due to having dnsmasq bound to localhost:22 on many hosts.
If there is a lighter weight alternative than CoreDNS via etcd avilable now, than that is likely a better option. Technically, with a proper plugin CoreDNS could have implemented external-dns by itself (Without actually needing external-dns itself), there just isn't a plugin that implements external-dns currently (What exists implements different behaviours than external-dns, unless things changed since I last checked)
/reopen
@segevfiner: Reopened this issue.
externaldns has support for RFC2136 as well and a quick proof of concept on my machine worked flawlessly using hostNetwork: true
. Seems promising!
any progress on this issue?
Add an addon for installing external DNS. See https://github.com/kubernetes-sigs/external-dns/blob/master/docs/tutorials/coredns.md which uses CoreDNS as the DNS server.
Unlike ingress-dns, which is minikube specific:
Some notes about configuring the host that also apply for ingress-dns:
systemd-resolved
, you can usesystemd.network
units for configuring DNS domain specific DNS servers. Using theDomains
&DNS
keys in a new network unit matching the required interface. I used it before, but don't remember the details.