Skip to content

Commit d1a1973

Browse files
authored
Merge pull request #44486 from my-git9/access-cluster-api-324
[zh-cn] sync access-cluster-api change-default-storage-class
2 parents 7b4c3a5 + 6a5f213 commit d1a1973

File tree

2 files changed

+71
-33
lines changed

2 files changed

+71
-33
lines changed

content/zh-cn/docs/tasks/administer-cluster/access-cluster-api.md

Lines changed: 62 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ weight: 60
1414
<!--
1515
This page shows how to access clusters using the Kubernetes API.
1616
-->
17-
本页展示了如何使用 Kubernetes API 访问集群
17+
本页展示了如何使用 Kubernetes API 访问集群
1818

1919
## {{% heading "prerequisites" %}}
2020

@@ -35,7 +35,7 @@ This page shows how to access clusters using the Kubernetes API.
3535
When accessing the Kubernetes API for the first time, use the
3636
Kubernetes command-line tool, `kubectl`.
3737
-->
38-
首次访问 Kubernetes API 时,请使用 Kubernetes 命令行工具 `kubectl`
38+
首次访问 Kubernetes API 时,请使用 Kubernetes 命令行工具 `kubectl`
3939

4040
<!--
4141
To access a cluster, you need to know the location of the cluster and have credentials
@@ -71,12 +71,16 @@ kubectl handles locating and authenticating to the API server. If you want to di
7171
-->
7272
### 直接访问 REST API
7373

74-
kubectl 处理对 API 服务器的定位和身份验证。如果你想通过 http 客户端(如 `curl``wget`
74+
kubectl 处理对 API 服务器的定位和身份验证。如果你想通过 http 客户端(如 `curl``wget`
7575
或浏览器)直接访问 REST API,你可以通过多种方式对 API 服务器进行定位和身份验证:
7676

7777
<!--
78-
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.
79-
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.
78+
1. Run kubectl in proxy mode (recommended). This method is recommended, since it uses
79+
the stored apiserver location and verifies the identity of the API server using a
80+
self-signed cert. No man-in-the-middle (MITM) attack is possible using this method.
81+
1. Alternatively, you can provide the location and credentials directly to the http client.
82+
This works with client code that is confused by proxies. To protect against man in the
83+
middle attacks, you'll need to import a root cert into your browser.
8084
-->
8185
1. 以代理模式运行 kubectl(推荐)。
8286
推荐使用此方法,因为它用存储的 apiserver 位置并使用自签名证书验证 API 服务器的标识。
@@ -86,7 +90,7 @@ kubectl 处理对 API 服务器的定位和身份验证。如果你想通过 htt
8690
为防止中间人攻击,你需要将根证书导入浏览器。
8791

8892
<!--
89-
Using the Go or Python client libraries provides accessing kubectl in proxy mode.
93+
Using the Go or Python client libraries provides accessing kubectl in proxy mode.
9094
-->
9195
使用 Go 或 Python 客户端库可以在代理模式下访问 kubectl。
9296

@@ -237,7 +241,11 @@ describes how you can configure this as a cluster administrator.
237241
<!--
238242
### Programmatic access to the API
239243
240-
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.
244+
Kubernetes officially supports client libraries for [Go](#go-client), [Python](#python-client),
245+
[Java](#java-client), [dotnet](#dotnet-client), [JavaScript](#javascript-client), and
246+
[Haskell](#haskell-client). There are other client libraries that are provided and maintained by
247+
their authors, not the Kubernetes team. See [client libraries](/docs/reference/using-api/client-libraries/)
248+
for accessing the API from other languages and how they authenticate.
241249
-->
242250
### 编程方式访问 API
243251

@@ -254,17 +262,21 @@ Kubernetes 官方支持 [Go](#go-client)、[Python](#python-client)、[Java](#ja
254262
#### Go 客户端 {#go-client}
255263

256264
<!--
257-
* To get the library, run the following command: `go get k8s.io/client-go@kubernetes-<kubernetes-version-number>` See [https://github.com/kubernetes/client-go/releases](https://github.com/kubernetes/client-go/releases) to see which versions are supported.
265+
* To get the library, run the following command: `go get k8s.io/client-go@kubernetes-<kubernetes-version-number>`
266+
See [https://github.com/kubernetes/client-go/releases](https://github.com/kubernetes/client-go/releases)
267+
to see which versions are supported.
258268
* Write an application atop of the client-go clients.
259269
-->
260270

261271
* 要获取库,运行下列命令:`go get k8s.io/client-go/kubernetes-<kubernetes 版本号>`
262-
参见 [https://github.com/kubernetes/client-go/releases](https://github.com/kubernetes/client-go/releases) 查看受支持的版本。
272+
参见 [https://github.com/kubernetes/client-go/releases](https://github.com/kubernetes/client-go/releases)
273+
查看受支持的版本。
263274
* 基于 client-go 客户端编写应用程序。
264275

265276
{{< note >}}
266277
<!--
267-
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.
278+
client-go defines its own API objects, so if needed, import API definitions from client-go rather than
279+
from the main repository. For example, `import "k8s.io/client-go/kubernetes"` is correct.
268280
-->
269281
client-go 定义了自己的 API 对象,因此如果需要,从 client-go 而不是主仓库导入
270282
API 定义,例如 `import "k8s.io/client-go/kubernetes"` 是正确做法。
@@ -303,7 +315,8 @@ func main() {
303315
```
304316

305317
<!--
306-
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).
318+
If the application is deployed as a Pod in the cluster, see
319+
[Accessing the API from within a Pod](/docs/tasks/access-application-cluster/access-cluster/#accessing-the-api-from-a-pod).
307320
-->
308321
如果该应用程序部署为集群中的一个
309322
Pod,请参阅[从 Pod 内访问 API](/zh-cn/docs/tasks/access-application-cluster/access-cluster/#accessing-the-api-from-a-pod)
@@ -314,15 +327,18 @@ Pod,请参阅[从 Pod 内访问 API](/zh-cn/docs/tasks/access-application-clus
314327
#### Python 客户端 {#python-client}
315328

316329
<!--
317-
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.
330+
To use [Python client](https://github.com/kubernetes-client/python), run the following command:
331+
`pip install kubernetes`. See [Python Client Library page](https://github.com/kubernetes-client/python)
332+
for more installation options.
318333
-->
319334
要使用 [Python 客户端](https://github.com/kubernetes-client/python),运行下列命令:
320335
`pip install kubernetes`
321336
参见 [Python 客户端库主页](https://github.com/kubernetes-client/python)了解更多安装选项。
322337

323338
<!--
324339
The Python client can use the same [kubeconfig file](/docs/concepts/configuration/organize-cluster-access-kubeconfig/)
325-
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):
340+
as the kubectl CLI does to locate and authenticate to the API server. See this
341+
[example](https://github.com/kubernetes-client/python/blob/master/examples/out_of_cluster_config.py):
326342
-->
327343
Python 客户端可以使用与 kubectl 命令行工具相同的
328344
[kubeconfig 文件](/zh-cn/docs/concepts/configuration/organize-cluster-access-kubeconfig/)
@@ -361,12 +377,14 @@ mvn install
361377
```
362378

363379
<!--
364-
See [https://github.com/kubernetes-client/java/releases](https://github.com/kubernetes-client/java/releases) to see which versions are supported.
380+
See [https://github.com/kubernetes-client/java/releases](https://github.com/kubernetes-client/java/releases)
381+
to see which versions are supported.
365382
366383
The Java client can use the same [kubeconfig file](/docs/concepts/configuration/organize-cluster-access-kubeconfig/)
367-
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):
384+
as the kubectl CLI does to locate and authenticate to the API server. See this
385+
[example](https://github.com/kubernetes-client/java/blob/master/examples/examples-release-15/src/main/java/io/kubernetes/client/examples/KubeConfigFileClientExample.java):
368386
-->
369-
参阅[https://github.com/kubernetes-client/java/releases](https://github.com/kubernetes-client/java/releases)
387+
参阅 [https://github.com/kubernetes-client/java/releases](https://github.com/kubernetes-client/java/releases)
370388
了解当前支持的版本。
371389

372390
Java 客户端可以使用 kubectl 命令行所使用的
@@ -424,21 +442,28 @@ public class KubeConfigFileClientExample {
424442
<!--
425443
#### dotnet client
426444
427-
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.
445+
To use [dotnet client](https://github.com/kubernetes-client/csharp),
446+
run the following command: `dotnet add package KubernetesClient --version 1.6.1`
447+
See [dotnet Client Library page](https://github.com/kubernetes-client/csharp)
448+
for more installation options. See
449+
[https://github.com/kubernetes-client/csharp/releases](https://github.com/kubernetes-client/csharp/releases)
450+
to see which versions are supported.
428451
429452
The dotnet client can use the same [kubeconfig file](/docs/concepts/configuration/organize-cluster-access-kubeconfig/)
430-
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):
453+
as the kubectl CLI does to locate and authenticate to the API server. See this
454+
[example](https://github.com/kubernetes-client/csharp/blob/master/examples/simple/PodList.cs):
431455
-->
432456
#### .Net 客户端 {#dotnet-client}
433457

434-
要使用[.Net 客户端](https://github.com/kubernetes-client/csharp),运行下面的命令:
458+
要使用 [.Net 客户端](https://github.com/kubernetes-client/csharp),运行下面的命令:
435459
`dotnet add package KubernetesClient --version 1.6.1`
436-
参见[.Net 客户端库页面](https://github.com/kubernetes-client/csharp)了解更多安装选项。
460+
参见 [.Net 客户端库页面](https://github.com/kubernetes-client/csharp)了解更多安装选项。
437461
关于可支持的版本,参见[https://github.com/kubernetes-client/csharp/releases](https://github.com/kubernetes-client/csharp/releases)
438462

439-
.Net 客户端可以使用与 kubectl CLI 相同的 [kubeconfig 文件](/zh-cn/docs/concepts/configuration/organize-cluster-access-kubeconfig/)
440-
来定位并验证 API 服务器。
441-
参见[样例](https://github.com/kubernetes-client/csharp/blob/master/examples/simple/PodList.cs):
463+
.Net 客户端可以使用与 kubectl CLI 相同的
464+
[kubeconfig 文件](/zh-cn/docs/concepts/configuration/organize-cluster-access-kubeconfig/)来定位并验证
465+
API 服务器。
466+
参见[样例](https://github.com/kubernetes-client/csharp/blob/master/examples/simple/PodList.cs)
442467

443468
```csharp
444469
using System;
@@ -471,10 +496,14 @@ namespace simple
471496
<!--
472497
#### JavaScript client
473498
474-
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.
499+
To install [JavaScript client](https://github.com/kubernetes-client/javascript),
500+
run the following command: `npm install @kubernetes/client-node`. See
501+
[https://github.com/kubernetes-client/javascript/releases](https://github.com/kubernetes-client/javascript/releases)
502+
to see which versions are supported.
475503
476504
The JavaScript client can use the same [kubeconfig file](/docs/concepts/configuration/organize-cluster-access-kubeconfig/)
477-
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):
505+
as the kubectl CLI does to locate and authenticate to the API server. See this
506+
[example](https://github.com/kubernetes-client/javascript/blob/master/examples/example.js):
478507
-->
479508
#### JavaScript 客户端 {#javascript-client}
480509

@@ -503,14 +532,18 @@ k8sApi.listNamespacedPod('default').then((res) => {
503532
<!--
504533
#### Haskell client
505534
506-
See [https://github.com/kubernetes-client/haskell/releases](https://github.com/kubernetes-client/haskell/releases) to see which versions are supported.
535+
See [https://github.com/kubernetes-client/haskell/releases](https://github.com/kubernetes-client/haskell/releases)
536+
to see which versions are supported.
507537
508-
The [Haskell client](https://github.com/kubernetes-client/haskell) can use the same [kubeconfig file](/docs/concepts/configuration/organize-cluster-access-kubeconfig/)
509-
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):
538+
The [Haskell client](https://github.com/kubernetes-client/haskell) can use the same
539+
[kubeconfig file](/docs/concepts/configuration/organize-cluster-access-kubeconfig/)
540+
as the kubectl CLI does to locate and authenticate to the API server. See this
541+
[example](https://github.com/kubernetes-client/haskell/blob/master/kubernetes-client/example/App.hs):
510542
-->
511543
#### Haskell 客户端 {#haskell-client}
512544

513-
参考 [https://github.com/kubernetes-client/haskell/releases](https://github.com/kubernetes-client/haskell/releases) 了解支持的版本。
545+
参考 [https://github.com/kubernetes-client/haskell/releases](https://github.com/kubernetes-client/haskell/releases)
546+
了解支持的版本。
514547

515548
[Haskell 客户端](https://github.com/kubernetes-client/haskell)
516549
可以使用 kubectl 命令行所使用的

content/zh-cn/docs/tasks/administer-cluster/change-default-storage-class.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,17 @@ for details about addon manager and how to disable individual addons.
5858
## 改变默认 StorageClass
5959

6060
<!--
61-
1. List the StorageClasses in your cluster:
61+
1. List the StorageClasses in your cluster:
6262
-->
63-
1. 列出你的集群中的 StorageClasses
63+
1. 列出你的集群中的 StorageClass
6464

6565
```shell
6666
kubectl get storageclass
6767
```
6868

69+
<!--
70+
The output is similar to this:
71+
-->
6972
输出类似这样:
7073

7174
```bash
@@ -74,6 +77,9 @@ for details about addon manager and how to disable individual addons.
7477
gold kubernetes.io/gce-pd 1d
7578
```
7679

80+
<!--
81+
The default StorageClass is marked by `(default)`.
82+
-->
7783
默认 StorageClass 以 `(default)` 标记。
7884

7985
<!--
@@ -151,5 +157,4 @@ for details about addon manager and how to disable individual addons.
151157
<!--
152158
* Learn more about [PersistentVolumes](/docs/concepts/storage/persistent-volumes/).
153159
-->
154-
* 进一步了解 [PersistentVolumes](/zh-cn/docs/concepts/storage/persistent-volumes/)
155-
160+
* 进一步了解 [PersistentVolume](/zh-cn/docs/concepts/storage/persistent-volumes/)

0 commit comments

Comments
 (0)