From 8c4a729d84047ece0bbd314e186c7ca63f7a60b4 Mon Sep 17 00:00:00 2001 From: Rajesh Deshpande <47311048+rajeshdeshpande02@users.noreply.github.com> Date: Sat, 23 Mar 2019 03:54:11 +0530 Subject: [PATCH] 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. --- content/en/docs/concepts/configuration/overview.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/content/en/docs/concepts/configuration/overview.md b/content/en/docs/concepts/configuration/overview.md index b7d74b4abe..d1069d34d2 100644 --- a/content/en/docs/concepts/configuration/overview.md +++ b/content/en/docs/concepts/configuration/overview.md @@ -46,7 +46,10 @@ This is a living document. If you think of something that is not on this list bu FOO_SERVICE_PORT= ``` - 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`.