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
+48-18Lines changed: 48 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -39,10 +39,14 @@ kubectl. Complete documentation is found in the [kubectl manual](/docs/reference
39
39
kubectl handles locating and authenticating to the API server. If you want to directly access the REST API with an http client like
40
40
`curl` or `wget`, or a browser, there are multiple ways you can locate and authenticate against the API server:
41
41
42
-
1. Run kubectl in proxy mode (recommended). This method is recommended, since it uses the stored apiserver location and verifies the identity of the API server using a self-signed cert. No man-in-the-middle (MITM) attack is possible using this method.
43
-
1. Alternatively, you can provide the location and credentials directly to the http client. This works with client code that is confused by proxies. To protect against man in the middle attacks, you'll need to import a root cert into your browser.
42
+
1. Run kubectl in proxy mode (recommended). This method is recommended, since it uses
43
+
the stored API server location and verifies the identity of the API server using a
44
+
self-signed certificate. No man-in-the-middle (MITM) attack is possible using this method.
45
+
1. Alternatively, you can provide the location and credentials directly to the http client.
46
+
This works with client code that is confused by proxies. To protect against man in the
47
+
middle attacks, you'll need to import a root cert into your browser.
44
48
45
-
Using the Go or Python client libraries provides accessing kubectl in proxy mode.
49
+
Using the Go or Python client libraries provides accessing kubectl in proxy mode.
46
50
47
51
#### Using kubectl proxy
48
52
@@ -151,16 +155,23 @@ describes how you can configure this as a cluster administrator.
151
155
152
156
### Programmatic access to the API
153
157
154
-
Kubernetes officially supports client libraries for [Go](#go-client), [Python](#python-client), [Java](#java-client), [dotnet](#dotnet-client), [JavaScript](#javascript-client), and [Haskell](#haskell-client). There are other client libraries that are provided and maintained by their authors, not the Kubernetes team. See [client libraries](/docs/reference/using-api/client-libraries/) for accessing the API from other languages and how they authenticate.
158
+
Kubernetes officially supports client libraries for [Go](#go-client), [Python](#python-client),
159
+
[Java](#java-client), [dotnet](#dotnet-client), [JavaScript](#javascript-client), and
160
+
[Haskell](#haskell-client). There are other client libraries that are provided and maintained by
161
+
their authors, not the Kubernetes team. See [client libraries](/docs/reference/using-api/client-libraries/)
162
+
for accessing the API from other languages and how they authenticate.
155
163
156
164
#### Go client
157
165
158
-
* To get the library, run the following command: `go get k8s.io/client-go@kubernetes-` See [https://github.com/kubernetes/client-go/releases](https://github.com/kubernetes/client-go/releases) to see which versions are supported.
166
+
* To get the library, run the following command: `go get k8s.io/client-go@kubernetes-`
167
+
See [https://github.com/kubernetes/client-go/releases](https://github.com/kubernetes/client-go/releases)
168
+
to see which versions are supported.
159
169
* Write an application atop of the client-go clients.
160
170
161
171
{{< note >}}
162
172
163
-
client-go defines its own API objects, so if needed, import API definitions from client-go rather than from the main repository. For example, `import "k8s.io/client-go/kubernetes"` is correct.
173
+
`client-go` defines its own API objects, so if needed, import API definitions from client-go rather than
174
+
from the main repository. For example, `import "k8s.io/client-go/kubernetes"` is correct.
164
175
165
176
{{< /note >}}
166
177
@@ -190,14 +201,18 @@ func main() {
190
201
}
191
202
```
192
203
193
-
If the application is deployed as a Pod in the cluster, see [Accessing the API from within a Pod](/docs/tasks/access-application-cluster/access-cluster/#accessing-the-api-from-a-pod).
204
+
If the application is deployed as a Pod in the cluster, see
205
+
[Accessing the API from within a Pod](/docs/tasks/access-application-cluster/access-cluster/#accessing-the-api-from-a-pod).
194
206
195
207
#### Python client
196
208
197
-
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.
209
+
To use [Python client](https://github.com/kubernetes-client/python), run the following command:
210
+
`pip install kubernetes`. See [Python Client Library page](https://github.com/kubernetes-client/python)
211
+
for more installation options.
198
212
199
213
The Python client can use the same [kubeconfig file](/docs/concepts/configuration/organize-cluster-access-kubeconfig/)
200
-
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):
214
+
as the kubectl CLI does to locate and authenticate to the API server. See this
See [https://github.com/kubernetes-client/java/releases](https://github.com/kubernetes-client/java/releases) to see which versions are supported.
242
+
See [https://github.com/kubernetes-client/java/releases](https://github.com/kubernetes-client/java/releases)
243
+
to see which versions are supported.
228
244
229
245
The Java client can use the same [kubeconfig file](/docs/concepts/configuration/organize-cluster-access-kubeconfig/)
230
-
as the kubectl CLI does to locate and authenticate to the API server. See this [example](https://github.com/kubernetes-client/java/blob/master/examples/examples-release-15/src/main/java/io/kubernetes/client/examples/KubeConfigFileClientExample.java):
246
+
as the kubectl CLI does to locate and authenticate to the API server. See this
@@ -278,10 +295,16 @@ public class KubeConfigFileClientExample {
278
295
279
296
#### dotnet client
280
297
281
-
To use [dotnet client](https://github.com/kubernetes-client/csharp), run the following command: `dotnet add package KubernetesClient --version 1.6.1` See [dotnet Client Library page](https://github.com/kubernetes-client/csharp) for more installation options. See [https://github.com/kubernetes-client/csharp/releases](https://github.com/kubernetes-client/csharp/releases) to see which versions are supported.
298
+
To use [dotnet client](https://github.com/kubernetes-client/csharp),
299
+
run the following command: `dotnet add package KubernetesClient --version 1.6.1`.
300
+
See [dotnet Client Library page](https://github.com/kubernetes-client/csharp)
The dotnet client can use the same [kubeconfig file](/docs/concepts/configuration/organize-cluster-access-kubeconfig/)
284
-
as the kubectl CLI does to locate and authenticate to the API server. See this [example](https://github.com/kubernetes-client/csharp/blob/master/examples/simple/PodList.cs):
306
+
as the kubectl CLI does to locate and authenticate to the API server. See this
To install [JavaScript client](https://github.com/kubernetes-client/javascript), run the following command: `npm install @kubernetes/client-node`. See [https://github.com/kubernetes-client/javascript/releases](https://github.com/kubernetes-client/javascript/releases) to see which versions are supported.
339
+
To install [JavaScript client](https://github.com/kubernetes-client/javascript),
340
+
run the following command: `npm install @kubernetes/client-node`. See
The JavaScript client can use the same [kubeconfig file](/docs/concepts/configuration/organize-cluster-access-kubeconfig/)
319
-
as the kubectl CLI does to locate and authenticate to the API server. See this [example](https://github.com/kubernetes-client/javascript/blob/master/examples/example.js):
345
+
as the kubectl CLI does to locate and authenticate to the API server. See this
See [https://github.com/kubernetes-client/haskell/releases](https://github.com/kubernetes-client/haskell/releases) to see which versions are supported.
363
+
See [https://github.com/kubernetes-client/haskell/releases](https://github.com/kubernetes-client/haskell/releases)
364
+
to see which versions are supported.
337
365
338
-
The [Haskell client](https://github.com/kubernetes-client/haskell) can use the same [kubeconfig file](/docs/concepts/configuration/organize-cluster-access-kubeconfig/)
339
-
as the kubectl CLI does to locate and authenticate to the API server. See this [example](https://github.com/kubernetes-client/haskell/blob/master/kubernetes-client/example/App.hs):
366
+
The [Haskell client](https://github.com/kubernetes-client/haskell) can use the same
0 commit comments