Skip to content
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: Headless services #1607

Closed
bgrant0607 opened this issue Oct 7, 2014 · 19 comments
Closed

Proposal: Headless services #1607

bgrant0607 opened this issue Oct 7, 2014 · 19 comments
Labels
area/api Indicates an issue on api area. area/downward-api kind/design Categorizes issue or PR as related to design. priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/network Categorizes an issue or PR as relevant to SIG Network.

Comments

@bgrant0607
Copy link
Member

Related to #1437, though this isn't the only solution to it.

A number of forms of discovery/naming/addressing are covered by other issues:

The remaining hole is individually addressable dynamically scaled services and worker pools.

The user could tie use PreStart/PostStart and PreStop hooks to self-register with a discovery system, such as etcd, consul, or eureka, as mentioned in #386 and elsewhere.

A more integrated solution could be to support Headless services. The endpoints_controller already creates endpoint records in etcd for services, which are also made available via the API. Headless services would do the same, just without creating an IP and/or DNS name for the service. This would create an API that clients could use to watch the set of endpoints associated with the headless service, and which would take advantage of whatever UI, readiness probes, etc. we add for services more generally, and which would be available for Kubernetes applications without the need to run a separate discovery service.

The tradeoff for a developer would be whether to couple to the Kubernetes API or to a particular discovery system. This API would not preclude the self-registration approach, however, and adapters for other discovery systems could be built upon this API, as well.

Improvements to the existing endpoints API and implementation (e.g. efficient watching of joins/leaves) are orthogonal issues.

@bgrant0607 bgrant0607 added kind/design Categorizes issue or PR as related to design. sig/network Categorizes an issue or PR as relevant to SIG Network. area/api Indicates an issue on api area. area/downward-api labels Oct 7, 2014
@bgrant0607 bgrant0607 added this to the v0.9 milestone Oct 7, 2014
@thockin
Copy link
Member

thockin commented Oct 7, 2014

Is the optimization (no DNS or IP) worth the complexity of a new noun?

On Mon, Oct 6, 2014 at 5:26 PM, bgrant0607 notifications@github.com wrote:

Related to #1437
#1437, though
this isn't the only solution to it.

A number of forms of discovery/naming/addressing are covered by other
issues:

The remaining hole is individually addressable dynamically scaled services
and worker pools.

The user could tie use PreStart/PostStart and PreStop hooks to
self-register with a discovery system, such as etcd, consul, or eureka, as
mentioned in #386
#386 and
elsewhere.

A more integrated solution could be to support Headless services. The
endpoints_controller already creates endpoint records in etcd for services,
which are also made available via the API. Headless services would do the
same, just without creating an IP and/or DNS name for the service. This
would create an API that clients could use to watch the set of endpoints
associated with the headless service, and which would take advantage of
whatever UI, readiness probes, etc. we add for services more generally, and
which would be available for Kubernetes applications without the need to
run a separate discovery service.

The tradeoff for a developer would be whether to couple to the Kubernetes
API or to a particular discovery system. This API would not preclude the
self-registration approach, however, and adapters for other discovery
systems could be built upon this API, as well.

Improvements to the existing endpoints API and implementation (e.g.
efficient watching of joins/leaves) are orthogonal issues.

Reply to this email directly or view it on GitHub
#1607.

@bgrant0607
Copy link
Member Author

@thockin Not necessarily. This could be as little as blessing the endpoint API for client usage and documenting the pattern, or simply an option on services, or perhaps there will be some other way to provide this capability when we extend services to handle other cases, such as external IPs. I split #260 into individual use cases, of which this the last one, I believe.

@erictune
Copy link
Member

erictune commented Oct 7, 2014

These processes in worker pools: do none of them serve on any host:port, or do some serve application monitoring data such as /varz?

If some serve, how does application monitoring collection discover the host:ports it should collect from, if there are no IPs or DNS names?

@bgrant0607
Copy link
Member Author

@erictune The pod IP:port list would be published via the Endpoints API.

(For others, /varz is like Go's expvar /debug/vars.)

@bgrant0607 bgrant0607 modified the milestones: v1.0, v0.9 Oct 27, 2014
@bgrant0607 bgrant0607 added the priority/backlog Higher priority than priority/awaiting-more-evidence. label Dec 3, 2014
@goltermann goltermann removed this from the v1.0 milestone Feb 6, 2015
@bgrant0607 bgrant0607 removed this from the v1.0 milestone Feb 6, 2015
@davidopp davidopp added sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. team/cluster labels Feb 17, 2015
@bgrant0607
Copy link
Member Author

I think this could be as simple as accepting "none" for PortalIP.

@bgrant0607 bgrant0607 added status/help-wanted priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done. and removed priority/backlog Higher priority than priority/awaiting-more-evidence. labels Feb 28, 2015
@bgrant0607
Copy link
Member Author

I'd be fine with PortalIP=none. We shouldn't allocate an IP, create links vars, nor publish DNS for such services.

Just search for all uses of PortalIP (including kube2sky):
https://github.com/GoogleCloudPlatform/kubernetes/search?l=go&q=PortalIP&utf8=%E2%9C%93

@bgrant0607
Copy link
Member Author

Nit: Should be None, to obey our constant convention.

@smarterclayton
Copy link
Contributor

Hrm - but that means portalIP has a different type depending on what object you've selected.

@smarterclayton
Copy link
Contributor

I think this needs to be a separate field, distinct from portalIP, that does all of the things you describe.

@smarterclayton
Copy link
Contributor

Why wouldn't we publish DNS for headless services? I'd actually want that behavior in any case where it's a cluster.

@bgrant0607
Copy link
Member Author

@smarterclayton PortalIP is type string. :-)

I'm not opposed to a separate field. I took inspiration from your exploitation of a nil selector. :-)

I think of nominal services #260 as the solution for clusters with DNS.

You really want DNS dynamically updated every time a pod is added or removed?

@smarterclayton
Copy link
Contributor

On Mar 16, 2015, at 6:52 PM, Brian Grant notifications@github.com wrote:

@smarterclayton PortalIP is type string. :-)

I guess, although we wanted it to be typed more strongly I thought.
I'm not opposed to a separate field. I took inspiration from your exploitation of a nil selector. :-)

Guilty as charged. Maybe it's not so bad, that was just a gut reaction at first blush. I will look at our client code and see whether I still have a strong reaction (in terms of client complexity). Our deferred ip resolution (controller based allocation) will mean clients will need to wait for that value to be filled out anyway, so it may not be as bad as I thought. Would there be other magic variables in the future? An anycast/multicast address?
I think of nominal services #260 as the solution for clusters with DNS.

Sorry, I got nominal and headless confused. Agree, although some overlap is expected.
You really want DNS dynamically updated every time a pod is added or removed?

In OpenShift we went a step further and make DNS dynamic - membership is done at query time, not manipulated at state time. So there's no extra cost other than size of DNS response. It's really just exposing endpoints directly via DNS.

Reply to this email directly or view it on GitHub.

@abhgupta
Copy link

@bgrant0607 @smarterclayton Refer my early stage PR on this change --> #5556

@bgrant0607
Copy link
Member Author

#5556 is in. We're expecting a followup update to services.md.

We could also discuss whether some form of direct DNS publication for pod IPs makes sense.

@smarterclayton
Copy link
Contributor

Here's how OpenShift is doing headless service DNS: openshift/origin#1510

@smarterclayton
Copy link
Contributor

Should headless services be able to be assigned an external load balancer? I don't know that the Kube proxy properly creates an anonymous port for them. If headless means "don't give me a portalIP because I can't use it", the answer is no. If headless means "don't expose me into other containers or give me a portal ip" the answer might still be yes. As a consumer I might still stick a headless service behind a load balancer.

@thockin
Copy link
Member

thockin commented Apr 26, 2015

I think headless means "don't give me a portalIP because I can't use it"

On Wed, Apr 8, 2015 at 6:17 PM, Clayton Coleman notifications@github.com
wrote:

Should headless services be able to be assigned an external load balancer?
I don't know that the Kube proxy properly creates an anonymous port for
them. If headless means "don't give me a portalIP because I can't use it",
the answer is no. If headless means "don't expose me into other containers
or give me a portal ip" the answer might still be yes. As a consumer I
might still stick a headless service behind a load balancer.


Reply to this email directly or view it on GitHub
#1607 (comment)
.

@smarterclayton
Copy link
Contributor

Or I prefer to be addressed by my endpoints directly? Either way, I think services with portals are a subset of all portals, and it seems like all that changes with a portalIP is that your default DNS name resolves differently.

On Apr 25, 2015, at 11:32 PM, Tim Hockin notifications@github.com wrote:

I think headless means "don't give me a portalIP because I can't use it"

On Wed, Apr 8, 2015 at 6:17 PM, Clayton Coleman notifications@github.com
wrote:

Should headless services be able to be assigned an external load balancer?
I don't know that the Kube proxy properly creates an anonymous port for
them. If headless means "don't give me a portalIP because I can't use it",
the answer is no. If headless means "don't expose me into other containers
or give me a portal ip" the answer might still be yes. As a consumer I
might still stick a headless service behind a load balancer.


Reply to this email directly or view it on GitHub
#1607 (comment)
.


Reply to this email directly or view it on GitHub.

@thockin
Copy link
Member

thockin commented Jul 9, 2015

I think this is done

@thockin thockin closed this as completed Jul 9, 2015
stlaz pushed a commit to stlaz/kubernetes that referenced this issue Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/api Indicates an issue on api area. area/downward-api kind/design Categorizes issue or PR as related to design. priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/network Categorizes an issue or PR as relevant to SIG Network.
Projects
None yet
Development

No branches or pull requests

7 participants