Skip to content

Commit 9cea107

Browse files
authored
Merge pull request #35442 from windsonsea/accessclus
[zh-cn] resync /tasks/administer-cluster/access-cluster-api.md
2 parents 283ed01 + b9494a2 commit 9cea107

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

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

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ kubectl handles locating and authenticating to the API server. If you want to di
6969
-->
7070
### 直接访问 REST API
7171

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

7475
<!--
7576
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.
@@ -235,8 +236,8 @@ Kubernetes officially supports client libraries for [Go](#go-client), [Python](#
235236
Kubernetes 官方支持 [Go](#go-client)[Python](#python-client)[Java](#java-client)
236237
[dotnet](#dotnet-client)[JavaScript](#javascript-client)[Haskell](#haskell-client)
237238
语言的客户端库。还有一些其他客户端库由对应作者而非 Kubernetes 团队提供并维护。
238-
参考[客户端库](/zh-cn/docs/reference/using-api/client-libraries/)了解如何使用其他语言
239-
来访问 API 以及如何执行身份认证。
239+
参考[客户端库](/zh-cn/docs/reference/using-api/client-libraries/)了解如何使用其他语言来访问 API
240+
以及如何执行身份认证。
240241

241242
<!-- #### Go client -->
242243

@@ -280,12 +281,12 @@ import (
280281
)
281282

282283
func main() {
283-
// uses the current context in kubeconfig
284-
// path-to-kubeconfig -- for example, /root/.kube/config
284+
// kubeconfig 中使用当前上下文
285+
// path-to-kubeconfig -- 例如 /root/.kube/config
285286
config, _ := clientcmd.BuildConfigFromFlags("", "<path-to-kubeconfig>")
286-
// creates the clientset
287+
// 创建 clientset
287288
clientset, _ := kubernetes.NewForConfig(config)
288-
// access the API to list pods
289+
// 访问 API 以列出 Pod
289290
pods, _ := clientset.CoreV1().Pods("").List(context.TODO(), v1.ListOptions{})
290291
fmt.Printf("There are %d pods in the cluster\n", len(pods.Items))
291292
}
@@ -305,7 +306,7 @@ To use [Python client](https://github.com/kubernetes-client/python), run the fol
305306
-->
306307
要使用 [Python 客户端](https://github.com/kubernetes-client/python),运行下列命令:
307308
`pip install kubernetes`
308-
参见 [Python 客户端库主页](https://github.com/kubernetes-client/python) 了解更多安装选项。
309+
参见 [Python 客户端库主页](https://github.com/kubernetes-client/python)了解更多安装选项。
309310

310311
<!--
311312
The Python client can use the same [kubeconfig file](/docs/concepts/cluster-administration/authenticate-across-clusters-kubeconfig/)
@@ -349,15 +350,15 @@ mvn install
349350
See [https://github.com/kubernetes-client/java/releases](https://github.com/kubernetes-client/java/releases) to see which versions are supported.
350351
351352
The Java client can use the same [kubeconfig file](/docs/concepts/configuration/organize-cluster-access-kubeconfig/)
352-
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/src/main/java/io/kubernetes/client/examples/KubeConfigFileClientExample.java):
353+
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):
353354
-->
354355
参阅[https://github.com/kubernetes-client/java/releases](https://github.com/kubernetes-client/java/releases)
355356
了解当前支持的版本。
356357

357358
Java 客户端可以使用 kubectl 命令行所使用的
358359
[kubeconfig 文件](/zh-cn/docs/concepts/configuration/organize-cluster-access-kubeconfig/)
359360
以定位 API 服务器并向其认证身份。
360-
参看此[示例](https://github.com/kubernetes-client/java/blob/master/examples/src/main/java/io/kubernetes/client/examples/KubeConfigFileClientExample.java)
361+
参看此[示例](https://github.com/kubernetes-client/java/blob/master/examples/examples-release-15/src/main/java/io/kubernetes/client/examples/KubeConfigFileClientExample.java)
361362

362363
```java
363364
package io.kubernetes.client.examples;
@@ -519,4 +520,4 @@ exampleWithKubeConfig = do
519520
<!--
520521
* [Accessing the Kubernetes API from a Pod](/docs/tasks/run-application/access-api-from-pod/)
521522
-->
522-
* [从 Pod 中访问 API](/zh-cn/docs/tasks/run-application/access-api-from-pod/)
523+
* [从 Pod 中访问 Kubernetes API](/zh-cn/docs/tasks/run-application/access-api-from-pod/)

0 commit comments

Comments
 (0)