@@ -316,82 +316,32 @@ Python 客户端可以像 kubectl CLI 一样使用相同的
316
316
## Accessing the API from a Pod
317
317
318
318
When accessing the API from a pod, locating and authenticating
319
- to the apiserver are somewhat different.
320
-
321
- The recommended way to locate the apiserver within the pod is with
322
- the `kubernetes.default.svc` DNS name, which resolves to a Service IP which in turn
323
- will be routed to an apiserver.
324
-
325
- The recommended way to authenticate to the apiserver is with a
326
- [service account](/docs/tasks/configure-pod-container/configure-service-account/) credential. By kube-system, a pod
327
- is associated with a service account, and a credential (token) for that
328
- service account is placed into the filesystem tree of each container in that pod,
329
- at `/var/run/secrets/kubernetes.io/serviceaccount/token`.
319
+ to the API server are somewhat different.
330
320
-->
331
321
### 从 Pod 中访问 API {#accessing-the-api-from-a-pod}
332
322
333
- 当你从 Pod 中访问 API 时,定位和验证 apiserver 会有些许不同。
334
-
335
- 在 Pod 中定位 apiserver 的推荐方式是通过 ` kubernetes.default.svc `
336
- 这个 DNS 名称,该名称将会解析为服务 IP,然后服务 IP 将会路由到 apiserver。
337
-
338
- 向 apiserver 进行身份验证的推荐方法是使用
339
- [ 服务帐户] ( /zh/docs/tasks/configure-pod-container/configure-service-account/ ) 凭据。
340
- 通过 kube-system,Pod 与服务帐户相关联,并且该服务帐户的凭证(token)
341
- 被放置在该 Pod 中每个容器的文件系统中,位于
342
- ` /var/run/secrets/kubernetes.io/serviceaccount/token ` 。
343
-
344
- <!--
345
- If available, a certificate bundle is placed into the filesystem tree of each
346
- container at `/var/run/secrets/kubernetes.io/serviceaccount/ca.crt`, and should be
347
- used to verify the serving certificate of the apiserver.
348
-
349
- Finally, the default namespace to be used for namespaced API operations is placed in a file
350
- at `/var/run/secrets/kubernetes.io/serviceaccount/namespace` in each container.
351
- -->
352
- 如果可用,则将证书放入每个容器的文件系统中的
353
- ` /var/run/secrets/kubernetes.io/serviceaccount/ca.crt ` ,
354
- 并且应该用于验证 apiserver 的服务证书。
355
-
356
- 最后,名字空间作用域的 API 操作所使用的 default 名字空间将被放置在
357
- 每个容器的 ` /var/run/secrets/kubernetes.io/serviceaccount/namespace `
358
- 文件中。
323
+ 当你从 Pod 中访问 API 时,定位和验证 API 服务器会有些许不同。
359
324
360
325
<!--
361
- From within a pod the recommended ways to connect to API are:
362
-
363
- - run `kubectl proxy` in a sidecar container in the pod, or as a background
364
- process within the container. This proxies the
365
- Kubernetes API to the localhost interface of the pod, so that other processes
366
- in any container of the pod can access it.
367
- - use the Go client library, and create a client using the `rest.InClusterConfig()` and `kubernetes.NewForConfig()` functions.
368
- They handle locating and authenticating to the apiserver. [example](https://git.k8s.io/client-go/examples/in-cluster-client-configuration/main.go)
369
-
370
- In each case, the credentials of the pod are used to communicate securely with the apiserver.
326
+ Please check [Accessing the API from within a Pod](/docs/tasks/run-application/access-api-from-pod/)
327
+ for more details.
371
328
-->
372
- 在 Pod 中,建议连接 API 的方法是:
373
-
374
- - 在 Pod 的边车容器中运行 ` kubectl proxy ` ,或者以后台进程的形式运行。
375
- 这将把 Kubernetes API 代理到当前 Pod 的 localhost 接口,
376
- 所以 Pod 中的所有容器中的进程都能访问它。
377
- - 使用 Go 客户端库,并使用 ` rest.InClusterConfig() ` 和
378
- ` kubernetes.NewForConfig() ` 函数创建一个客户端。
379
- 他们处理 apiserver 的定位和身份验证。
380
- [ 示例] ( https://git.k8s.io/client-go/examples/in-cluster-client-configuration/main.go )
381
-
382
- 在每种情况下,Pod 的凭证都是为了与 apiserver 安全地通信。
329
+ 请参阅[ 从 Pod 中访问 API] ( /zh/docs/tasks/run-application/access-api-from-pod/ )
330
+ 了解更多详情。
383
331
384
332
<!--
385
333
## Accessing services running on the cluster
386
334
387
- The previous section describes how to connect to the Kubernetes API server. For information about connecting to other services running on a Kubernetes cluster, see [Access Cluster Services.](/docs/tasks/administer-cluster/access-cluster-services/)
335
+ The previous section describes how to connect to the Kubernetes API server.
336
+ For information about connecting to other services running on a Kubernetes cluster, see
337
+ [Access Cluster Services](/docs/tasks/administer-cluster/access-cluster-services/).
388
338
-->
389
339
390
340
## 访问集群上运行的服务 {#accessing-services-running-on-the-cluster}
391
341
392
342
上一节介绍了如何连接到 Kubernetes API 服务器。
393
- 有关连接到 Kubernetes 集群上运行的其他服务的信息,请参阅[ 访问集群服务 ] ( /zh/docs/tasks/administer-cluster/access-cluster-services/ ) 。
394
-
343
+ 有关连接到 Kubernetes 集群上运行的其他服务的信息,请参阅
344
+ [ 访问集群服务 ] ( /zh/docs/tasks/administer-cluster/access-cluster-services/ ) 。
395
345
396
346
<!--
397
347
## Requesting redirects
0 commit comments