You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: content/en/docs/tasks/administer-cluster/access-cluster-api.md
+7-4
Original file line number
Diff line number
Diff line change
@@ -192,7 +192,7 @@ If the application is deployed as a Pod in the cluster, please refer to the [nex
192
192
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.
193
193
194
194
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):
196
196
197
197
```python
198
198
from kubernetes import client, config
@@ -239,11 +239,14 @@ at `/var/run/secrets/kubernetes.io/serviceaccount/namespace` in each container.
239
239
240
240
From within a Pod, the recommended ways to connect to the Kubernetes API are:
241
241
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.
245
244
See [an example here](https://git.k8s.io/client-go/examples/in-cluster-client-configuration/main.go).
246
245
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
+
247
250
- If you would like to query the API without an official client library, you can run `kubectl proxy`
248
251
as the [command](/docs/tasks/inject-data-application/define-command-argument-container/)
249
252
of a new sidecar container in the Pod. This way, `kubectl proxy` will authenticate
0 commit comments