Skip to content

Commit

Permalink
Fix in-cluster API discovery documentation
Browse files Browse the repository at this point in the history
The documentation incorrectly describes the way that client libraries
discover the Kubernetes API server. While the `kubernetes.default.svc`
DNS is provided as a convenience, **all** of the officially supported API
clients use environment variables to discover the address of the API server.

This change updates the documentation to reflect this.

Fixes kubernetes/kubernetes#112263

Signed-off-by: Oliver Gould <ver@buoyant.io>
  • Loading branch information
olix0r committed Sep 8, 2022
1 parent c9c77d2 commit 72e880b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions content/en/docs/tasks/run-application/access-api-from-pod.md
Expand Up @@ -42,10 +42,11 @@ securely with the API server.

### Directly accessing the REST API

While running in a Pod, the Kubernetes apiserver is accessible via a Service named
`kubernetes` in the `default` namespace. Therefore, Pods can use the
`kubernetes.default.svc` hostname to query the API server. Official client libraries
do this automatically.
While running in a Pod, the Kubernetes API server is referenced by the environment
variables `KUBERNETES_SERVICE_HOST` and `KUBERNETES_SERVICE_PORT`. As a convenience,
the API server may also be referenced via a Service named `kubernetes` in the `default`
namespace. Therefore, Pods can use the `kubernetes.default.svc` hostname to query the
API server.

The recommended way to authenticate to the API server is with a
[service account](/docs/tasks/configure-pod-container/configure-service-account/)
Expand Down

0 comments on commit 72e880b

Please sign in to comment.