-
Notifications
You must be signed in to change notification settings - Fork 40k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal: Internal Dynamic DNS service #1261
Comments
This relates to Services v2 -- #1107. @thockin -- can you integrate this thinking with what we've been talking about wrt Services v2. /cc @smarterclayton Personally, I'm scared of leaning on DNS too much. While there is nothing stopping DNS from being very dynamic, most clients very aggressively cache DNS results past the TTL. I'm in favor of having a great inward facing DNS solution but I think that we should make sure that the bulk of IPs returned are stable from the point of view of the client. (Which requires some network magic or proxying, etc) |
I agree that this would be purely for internal consumption not for publication (ala OpenShift). One aspect is to select proper TTL values and carefully choose what objects are published by DNS. It should be used where it is the right solution and others should be used if it is not. I'm interested in the comment "Aggressively cache DNS results". The caching servers do, and tools like ncd and possible sssd may. The resolver itself does not. Use cases for DNS must be tolerant of the TTL propagation delay for updates. In the example above the hostname/IP mapping for minions and their clients would be stable for the lifetime of the minion. Additional cases must be evaluated on their merits. |
This may have been half-baked. I'll still come up with the use cases but I was reacting to misunderstanding on my part about the scope of the problem from the vagrant cluster. This may be moot. |
I think there is an important role to be played by DNS, but that role is With Services v2 I think we can present the appearance of stable IPs for This is certainly an issue with room for people to help out :) On Wed, Sep 10, 2014 at 7:50 PM, Mark Lamourine notifications@github.com
|
Just an FYI, but it looks like as of docker 1.2.0 you can change the /etc/hosts file of a running container. see moby/moby#5129 |
This solution is a great big hack. It's not done atomically (indeed the We don't need it to be dynamic, I think. The static PR is much simpler. On Wed, Sep 10, 2014 at 9:35 PM, Derek Carr notifications@github.com
|
Disclaimer: I'm a co-author of Skydns (https://github.com/skynetservices/skydns) I'd be happy to change the license if needed, and would love to submit a PR for the SkyDNS <-> Kubernetes API bridge service. |
I have said elsewhere that the obvious DNS tie-in is for Service names. Just brainstorming. Make a flag per pod asking for DNS resolution. Make a Do we think DNS is a case of a general naming service plugin interface, or Tim
|
Being able to define special purpose DNS addresses adhoc is always nice, but I don't think the service -> dns focus is wrong. It just may be that when you define your service, instead of tying the dns entry to the service endpoint, make it resolve to the individual endpoints (the selected pods). That feels more "service-y" than adding dns to a repl controller, which then couples a template to a DNS label. I like flag per pod, but what happens when you want two pods to share a DNS entry? Back to services! You get into a bit of a "service-all-the-things" mentality, but some of the concerns with that (too many ports, names for things that are very similar) could be addressed by other flexibility on or around services, and are what you want to encourage. I think services are pets and pods are cattle in this vein - name your pets, count your cattle. Most of the things you could use names on pods for are things you want to discourage or handle at a lower level (if you want magic HA pod behavior for hosts, do it under the pod at the infra level so no one knows about it)
|
Also, SkyDNS was what I had in my head as were talking about this - glad to see there's interest on your end as well. |
I don't think that "use a service" is a bad answer for anything multi-pod.
|
Part of the portal / service design is you have to make an explicit choice to hardcode the dns name in your code or env - if the default path is easier (auto env var, or exposed on localhost via ambassador container or infra magic), it seems like folks won't be incentivized to hardcode dns. Or if you make dns exposure an option (explicitly declared) then you take the responsibility to do the right thing. Taken with what we've said that DNS is primarily an internal, inter-pod concept and that external exposure is typically an explicit choice for users or admins, that makes me think that there's less of a requirement to dictate general DNS internally, but more of a requirement to give operators the flexibility to do their own opinionated setups with delegation or mapping.
|
On /etc/hosts: moby/moby#8019 |
The discussion in #146 is relevant. I mostly agree with @smarterclayton. I am strongly in favor of publishing DNS for services. Service v2 (#1107) IP addresses should be reasonably stable -- as stable as the services. Among other things, this would make #1331 moot, would solve the problem of needing to resolve minion hostnames from within containers, and would eliminate our reliance on environment variables as a naming system. We should not publish DNS for pods nor for replication controllers. Both are ephemeral (cattle). For example, I want to be able to create new replication controllers to do rolling updates (#1353). So, even the names wouldn't be stable, much less the IP addresses. I'm hesitant to directly publish groups of service pod IPs to DNS, due to the aforementioned caching problems, as well as latency and scalability challenges (e.g., not good to need to reload 10000 IPs when one changes). Load balancers and load-balancing clients should use a more efficient mechanism to subscribe to membership changes in the presence of auto-scaling, rolling updates, rescheduling, etc. I'd be happy if a standard group membership watching API emerged, in which case we could adopt it and expose it to cloud-aware applications. It should also be possible for people to use their own discovery mechanism, such as etcd, Eureka, or Consul, by registering/unregistering ephemeral pod IP addresses in lifecycle hooks or in their cloud-aware applications, but, by definition, their clients are equipped to handle the dynamic bindings. |
@bketelsen We'd like to enable DNS in Kubernetes O(soon). Would you like to work together on this? |
As a matter of fact, I would, @bgrant0607 Where do we begin? I'll likely drag @erikstmartin along too, since he works with me and we wrote SkyDNS together. |
I think we want to run a DNS server by default with every kubernetes On Fri, Sep 26, 2014 at 5:17 PM, Brian Ketelsen notifications@github.com
|
FWIW, I have a branch with ip-per-service working. https://github.com/thockin/kubernetes/tree/services_v2 If we wanted to start playing with DNS, this would be a starting place. On Fri, Sep 26, 2014 at 8:13 PM, Tim Hockin thockin@google.com wrote:
|
I looked at your branch today, @thockin. Should I start sketching up my thoughts on how to integrate DNS? Also, what are your preferences on where the DNS Server should live? Is it another /cmd/, or should it be integrated into something directly, like apiserver or proxy/kubelet? |
So just to clarify. My idea was, that instead of resolving dns in each container and code/configure the application to use dns, it would be much simpler (as most applications use env vars for other things anyway) to use env vars from the application and let skydns handle the naming, assignment and resolving and on the other hand let kubernetes handle the injection of these supplied names into the containers via env vars. I hope I made my ideas and concerns a bit clearer. If not, I'll have to rethink my argument :) |
While I'm working through refactoring my proof of concept code, how is the integration between skydns and kubernetes going to work as far as documentation, packaging, deployment goes? |
|
Brian, Assuming all your changes are mainlined, I assume we would treat it like we What's the status on these changes? On Wed, Oct 8, 2014 at 7:48 PM, Brian Ketelsen notifications@github.com
|
Preliminary Kubernetes support is pending a merge into SkyDNS's repository. When it's merged, we'll create a new binary release and I'll update this thread. |
+1 to the question of packaging and deployment. If I understand how services access works, when the environment variables for a container are created kubernetes will need to know if it is working in a DNS enabled environment so it can put in an IP or a name to resolve as the service host. From there it enters the portal/ambassador infrastructure for routing. So I guess my questions are
|
https://github.com/skynetservices/skydns/releases/tag/2.0.1a Merged in SkyDNS, tagged at 2.0.1a |
Paul: We can still put IPs in the environment variables. Thus, for a service On Thu, Oct 16, 2014 at 12:22 PM, Paul notifications@github.com wrote:
|
Added an official skynetservices/skydns docker image as an automated build. |
How do I tell skydns where etcd servers are? On Wed, Oct 8, 2014 at 7:16 AM, Brian Ketelsen notifications@github.com
|
You can either |
All I see is: E1018 19:30:36.626006 00001 etcd.go:167] Failed to contact etcd for key ps auxw | grep skyroot 14914 0.0 0.2 277524 5044 ? Ssl 19:26 0:00 skydns On Sat, Oct 18, 2014 at 4:35 AM, Brian Ketelsen notifications@github.com
|
@thockin Try using IP addresses rather than DNS? |
I did that too On Sat, Oct 18, 2014 at 12:40 PM, bgrant0607 notifications@github.com
|
Are you running skydns in a container? Is etcd set to listen on all interfaces? That hit me yesterday. Sent from my iPhone
|
Winner. Etcd is on localhost only. Sigh. I'll have to think harder. On Sat, Oct 18, 2014 at 1:07 PM, Brian Ketelsen notifications@github.com
|
Aren't we just running this on the master node for now? Why not use localhost? We're going to have the same issue when we dockerize the other components. |
I was trying to run it under kubelet. If I add net=host support, which I
|
@bketelsen What's the status on reading from kubernetes API rather than On Sat, Oct 18, 2014 at 5:20 PM, Tim Hockin thockin@google.com wrote:
|
I'll finish it tonight. SkyDNS is broken anyway since the ID field was moved out of thing that used to be JSONBase. So I'll kill 2 birds with one stone. |
Just a heads up but definition for source API constructor will change slightly after this PR and I think you used it in your work.
|
Pieces are falling into place for DNS. This is a collection of thoughts and open questions. I'm going to @ some people, but please feel free to chime in on any issue. Sorry this got a bit long. Currently: We have IP-per-service. We have a read-only, rate-limited master interface. We will soon have a virtual service for the k8s master, so pods can find it. We have a PR pending to allow static portal IP assignment. The rough design looks like this: At cluster turnup, choose a static IP for DNS. Create a service using that IP selecting on "infrastructure=kubernetes-dns" (or similar). Launch DNS pods with that label. Now for open questions.
Any reason to go with docker flags instead of minions? @brendandburns had some argument that I have misplaced.
We still have an open issue for "global" services (like the master!), which maybe get DNSed as kubernetes.local, which every pod gets as a secondary --dns-search. This argues for using docker flags rather than minion configs.
I feel like I have forgotten some questions. Feel free to add more, folks. |
|
It seems like it makes more sense to use SkyDNS1, with modifications to make it K8s aware and remove the heavily regimented DNS structure enforcement. Both versions of skydns support up to 63 character host names, and 255 character total length.
|
An additional note - currently it's impossible to add a local name for the DNS resolve in Docker. We can set hostname, but we can't add an additional segment that makes Should we enforce / encourage a default where every pod has a deterministic address that resolves at least locally? Nominal services might be able to improve this (or mutate that value), but at least some LDAP servers will fail to start without a two segment local DNS entry. |
Closing for now. There's more to do, but I think the primary goal here has been achieved, no? |
Bug 2086092: UPSTREAM: 108284: fix: exclude non-ready nodes and deleted nodes from azure load balancers
There are instances where DNS is the best way to publish the presence of network resources.
Within a Kubernetes cluster minions, containers and services all have distinct IP addresses but in many cases these objects may need to migrate in a way which changes the IP. Clients that are consuming these services can find the new IP if they use DNS names rather than IP address as the service handle. The DNS records may change but the names will remain stable.
One specific case has raised this issue.
On each minion, when a new container is created the container is provded an environment variable SERVICE_MASTER. This variable indicates the location of the Kubernetes service proxy to which the processes within the container should connect. The value of this variable is a hostname (FQDN) which should resolve from within the container to the public IP address of the minion on which the container resides. It is not possible for Kubernetes, through Docker to inject a value into /etc/hosts into the container. It is possible for Docker to inject a nameserver IP address into /etc/resolv.conf. If the DNS service indicated correctly resolves the value of SERVICE_MASTER to the IP address of the hosting minion, then the processes within the container will connect properly to the minion proxy process.
Since Kubernetes is a dynamic service the DNS service must also be dynamic. New minions may be added (for this particular case). It may also be desirable to publish services with SRV records as well. As new IPs are allocated and names assigned, the Kubernetes service must be able to update the DNS name/address maps.
DNS service relies on several factors:
Docker provides a means to inject the nameserver values for /etc/resolv.conf in new containers.
service?
Solution proposals to follow.
The text was updated successfully, but these errors were encountered: