Skip to content

Commit 94bb13a

Browse files
edrandallk8s-ci-robot
authored andcommitted
Added missing in-pod Python client info (#16453) (#16460)
Issue #16453: Added missing in-pod Python client information; Fixed broken link to external Python client example
1 parent ff1a982 commit 94bb13a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

content/en/docs/tasks/administer-cluster/access-cluster-api.md

+7-4
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ If the application is deployed as a Pod in the cluster, please refer to the [nex
192192
To use [Python client](https://github.com/kubernetes-client/python), run the following command: `pip install kubernetes` See [Python Client Library page](https://github.com/kubernetes-client/python) for more installation options.
193193

194194
The Python client can use the same [kubeconfig file](/docs/concepts/cluster-administration/authenticate-across-clusters-kubeconfig/)
195-
as the kubectl CLI does to locate and authenticate to the API server. See this [example](https://github.com/kubernetes-client/python/tree/master/examples/example1.py):
195+
as the kubectl CLI does to locate and authenticate to the API server. See this [example](https://github.com/kubernetes-client/python/blob/master/examples/out_of_cluster_config.py):
196196

197197
```python
198198
from kubernetes import client, config
@@ -239,11 +239,14 @@ at `/var/run/secrets/kubernetes.io/serviceaccount/namespace` in each container.
239239

240240
From within a Pod, the recommended ways to connect to the Kubernetes API are:
241241

242-
- Use one of the official [client libraries](/docs/reference/using-api/client-libraries/)
243-
as they handle API host discovery and authentication automatically.
244-
For Go client, the `rest.InClusterConfig()` function assists with this.
242+
- For a Go client, use the official [Go client library](https://github.com/kubernetes/client-go/).
243+
The `rest.InClusterConfig()` function handles API host discovery and authentication automatically.
245244
See [an example here](https://git.k8s.io/client-go/examples/in-cluster-client-configuration/main.go).
246245

246+
- For a Python client, use the official [Python client library](https://github.com/kubernetes-client/python/).
247+
The `config.load_incluster_config()` function handles API host discovery and authentication automatically.
248+
See [an example here](https://github.com/kubernetes-client/python/blob/master/examples/in_cluster_config.py).
249+
247250
- If you would like to query the API without an official client library, you can run `kubectl proxy`
248251
as the [command](/docs/tasks/inject-data-application/define-command-argument-container/)
249252
of a new sidecar container in the Pod. This way, `kubectl proxy` will authenticate

0 commit comments

Comments
 (0)