Correcting service configuration details (#13302)
Existing details related to services are ambiguous as it does not give an idea when to use an environment variable for service discovery. Also, it does not talk about the DNS method of service discovery which is highly recommended. so corrected document to provide these missing details.pull/13363/head
parent
4e21e218c0
commit
8c4a729d84
|
@ -46,7 +46,10 @@ This is a living document. If you think of something that is not on this list bu
|
|||
FOO_SERVICE_PORT=<the port the Service is running on>
|
||||
```
|
||||
|
||||
If you are writing code that talks to a Service, don't use these environment variables; use the [DNS name of the Service](/docs/concepts/services-networking/dns-pod-service/) instead. Service environment variables are provided only for older software which can't be modified to use DNS lookups, and are a much less flexible way of accessing Services.
|
||||
*This does imply an ordering requirement* - any `Service` that a `Pod` wants to access must be created before the `Pod` itself, or else the environment variables will not be populated. DNS does not have this restriction.
|
||||
|
||||
- An optional (though strongly recommended) [cluster add-on](/docs/concepts/cluster-administration/addons/) is a DNS server. The
|
||||
DNS server watches the Kubernetes API for new `Services` and creates a set of DNS records for each. If DNS has been enabled throughout the cluster then all `Pods` should be able to do name resolution of `Services` automatically.
|
||||
|
||||
- Don't specify a `hostPort` for a Pod unless it is absolutely necessary. When you bind a Pod to a `hostPort`, it limits the number of places the Pod can be scheduled, because each <`hostIP`, `hostPort`, `protocol`> combination must be unique. If you don't specify the `hostIP` and `protocol` explicitly, Kubernetes will use `0.0.0.0` as the default `hostIP` and `TCP` as the default `protocol`.
|
||||
|
||||
|
|
Loading…
Reference in New Issue