Skip to content

Commit da025ec

Browse files
committed
[zh-cn] sync configure-pod-container/*
Signed-off-by: xin.li <xin.li@daocloud.io>
1 parent 224572c commit da025ec

15 files changed

+51
-51
lines changed

content/zh-cn/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Kubernetes 提供了存活探针来发现并处理这种情况。
102102
在本练习中,你会创建一个 Pod,其中运行一个基于 `registry.k8s.io/busybox` 镜像的容器。
103103
下面是这个 Pod 的配置文件。
104104

105-
{{% code file="pods/probe/exec-liveness.yaml" %}}
105+
{{% code_sample file="pods/probe/exec-liveness.yaml" %}}
106106

107107
<!--
108108
In the configuration file, you can see that the Pod has a single `Container`.
@@ -229,7 +229,7 @@ file for a Pod that runs a container based on the `registry.k8s.io/liveness` ima
229229
另外一种类型的存活探测方式是使用 HTTP GET 请求。
230230
下面是一个 Pod 的配置文件,其中运行一个基于 `registry.k8s.io/liveness` 镜像的容器。
231231

232-
{{% code file="pods/probe/http-liveness.yaml" %}}
232+
{{% code_sample file="pods/probe/http-liveness.yaml" %}}
233233

234234
<!--
235235
In the configuration file, you can see that the Pod has a single container.
@@ -325,7 +325,7 @@ can't it is considered a failure.
325325
使用这种配置时,kubelet 会尝试在指定端口和容器建立套接字链接。
326326
如果能建立连接,这个容器就被看作是健康的,如果不能则这个容器就被看作是有问题的。
327327

328-
{{% code file="pods/probe/tcp-liveness-readiness.yaml" %}}
328+
{{% code_sample file="pods/probe/tcp-liveness-readiness.yaml" %}}
329329

330330
<!--
331331
As you can see, configuration for a TCP check is quite similar to an HTTP check.
@@ -393,7 +393,7 @@ kubelet 可以配置为使用该协议来执行应用存活性检查。
393393

394394
下面是一个示例清单:
395395

396-
{{% code file="pods/probe/grpc-liveness.yaml" %}}
396+
{{% code_sample file="pods/probe/grpc-liveness.yaml" %}}
397397

398398
<!--
399399
To use a gRPC probe, `port` must be configured. If you want to distinguish probes of different types

content/zh-cn/docs/tasks/configure-pod-container/configure-persistent-volume-storage.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ Here is the configuration file for the hostPath PersistentVolume:
161161

162162
下面是 hostPath PersistentVolume 的配置文件:
163163

164-
{{% code file="pods/storage/pv-volume.yaml" %}}
164+
{{% code_sample file="pods/storage/pv-volume.yaml" %}}
165165

166166
<!--
167167
The configuration file specifies that the volume is at `/mnt/data` on the
@@ -227,7 +227,7 @@ Pod 使用 PersistentVolumeClaim 来请求物理存储。
227227

228228
下面是 PersistentVolumeClaim 的配置文件:
229229

230-
{{% code file="pods/storage/pv-claim.yaml" %}}
230+
{{% code_sample file="pods/storage/pv-claim.yaml" %}}
231231

232232
<!--
233233
Create the PersistentVolumeClaim:
@@ -299,7 +299,7 @@ Here is the configuration file for the Pod:
299299

300300
下面是此 Pod 的配置文件:
301301

302-
{{% code file="pods/storage/pv-pod.yaml" %}}
302+
{{% code_sample file="pods/storage/pv-pod.yaml" %}}
303303

304304
<!--
305305
Notice that the Pod's configuration file specifies a PersistentVolumeClaim, but
@@ -414,7 +414,7 @@ You can now close the shell to your Node.
414414
-->
415415
## 在两个地方挂载相同的 persistentVolume {#mounting-the-same-pv-in-two-places}
416416

417-
{{% code file="pods/storage/pv-duplicate.yaml" %}}
417+
{{% code_sample file="pods/storage/pv-duplicate.yaml" %}}
418418

419419
<!--
420420
You can perform 2 volume mounts on your nginx container:

content/zh-cn/docs/tasks/configure-pod-container/configure-pod-configmap.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,7 @@ section, and learn how to use these objects with Pods.
788788
-->
789789
2. 将 ConfigMap 中定义的 `special.how` 赋值给 Pod 规约中的 `SPECIAL_LEVEL_KEY` 环境变量。
790790
791-
{{% code file="pods/pod-single-configmap-env-variable.yaml" %}}
791+
{{% code_sample file="pods/pod-single-configmap-env-variable.yaml" %}}
792792
793793
<!--
794794
Create the Pod:
@@ -816,7 +816,7 @@ Here is the manifest you will use:
816816
与前面的示例一样,首先创建 ConfigMap。
817817
这是你将使用的清单:
818818

819-
{{% code file="configmap/configmaps.yaml" %}}
819+
{{% code_sample file="configmap/configmaps.yaml" %}}
820820

821821
<!--
822822
* Create the ConfigMap:
@@ -832,7 +832,7 @@ Here is the manifest you will use:
832832
-->
833833
* 在 Pod 规约中定义环境变量。
834834

835-
{{% code file="pods/pod-multiple-configmap-env-variable.yaml" %}}
835+
{{% code_sample file="pods/pod-multiple-configmap-env-variable.yaml" %}}
836836

837837
<!--
838838
Create the Pod:
@@ -867,7 +867,7 @@ Here is the manifest you will use:
867867
-->
868868
* 创建一个包含多个键值对的 ConfigMap。
869869

870-
{{% code file="configmap/configmap-multikeys.yaml" %}}
870+
{{% code_sample file="configmap/configmap-multikeys.yaml" %}}
871871

872872
<!--
873873
Create the ConfigMap:
@@ -885,7 +885,7 @@ Here is the manifest you will use:
885885
* 使用 `envFrom` 将所有 ConfigMap 的数据定义为容器环境变量,ConfigMap
886886
中的键成为 Pod 中的环境变量名称。
887887
888-
{{% code file="pods/pod-configmap-envFrom.yaml" %}}
888+
{{% code_sample file="pods/pod-configmap-envFrom.yaml" %}}
889889
890890
<!--
891891
Create the Pod:
@@ -928,7 +928,7 @@ For example, the following Pod manifest:
928928
-->
929929
例如,以下 Pod 清单:
930930
931-
{{% code file="pods/pod-configmap-env-var-valueFrom.yaml" %}}
931+
{{% code_sample file="pods/pod-configmap-env-var-valueFrom.yaml" %}}
932932
933933
<!--
934934
Create that Pod, by running:
@@ -978,7 +978,7 @@ The examples in this section refer to a ConfigMap named `special-config`:
978978
-->
979979
本节中的示例引用了一个名为 `special-config` 的 ConfigMap:
980980
981-
{{% code file="configmap/configmap-multikeys.yaml" %}}
981+
{{% code_sample file="configmap/configmap-multikeys.yaml" %}}
982982
983983
<!--
984984
Create the ConfigMap:
@@ -1004,7 +1004,7 @@ keys in ConfigMap.
10041004
(在本例中为 `/etc/config`)。
10051005
`command` 部分列出了名称与 ConfigMap 中的键匹配的目录文件。
10061006
1007-
{{% code file="pods/pod-configmap-volume.yaml" %}}
1007+
{{% code_sample file="pods/pod-configmap-volume.yaml" %}}
10081008
10091009
<!--
10101010
Create the Pod:
@@ -1063,7 +1063,7 @@ In this case, the `SPECIAL_LEVEL` item will be mounted in the `config-volume` vo
10631063
在这里,ConfigMap 中键 `SPECIAL_LEVEL` 的内容将挂载在 `config-volume`
10641064
卷中 `/etc/config/keys` 文件中。
10651065

1066-
{{% code file="pods/pod-configmap-volume-specific-key.yaml" %}}
1066+
{{% code_sample file="pods/pod-configmap-volume-specific-key.yaml" %}}
10671067

10681068
<!--
10691069
Create the Pod:

content/zh-cn/docs/tasks/configure-pod-container/configure-pod-initialization.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Here is the configuration file for the Pod:
3838

3939
下面是 Pod 的配置文件:
4040

41-
{{% code file="pods/init-containers.yaml" %}}
41+
{{% code_sample file="pods/init-containers.yaml" %}}
4242

4343
<!--
4444
In the configuration file, you can see that the Pod has a Volume that the init

content/zh-cn/docs/tasks/configure-pod-container/configure-runasusername.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Here is a configuration file for a Windows Pod that has the `runAsUserName` fiel
5454

5555
这儿有一个已经设置了 `runAsUserName` 字段的 Windows Pod 的配置文件:
5656

57-
{{% code file="windows/run-as-username-pod.yaml" %}}
57+
{{% code_sample file="windows/run-as-username-pod.yaml" %}}
5858

5959
<!--
6060
Create the Pod:
@@ -134,7 +134,7 @@ Here is the configuration file for a Pod that has one Container, and the `runAsU
134134

135135
这里有一个 Pod 的配置文件,其中只有一个容器,并且在 Pod 级别和容器级别都设置了 `runAsUserName`
136136

137-
{{% code file="windows/run-as-username-container.yaml" %}}
137+
{{% code_sample file="windows/run-as-username-container.yaml" %}}
138138

139139
<!--
140140
Create the Pod:
@@ -184,7 +184,9 @@ ContainerAdministrator
184184
<!--
185185
## Windows Username limitations
186186
187-
In order to use this feature, the value set in the `runAsUserName` field must be a valid username. It must have the following format: `DOMAIN\USER`, where `DOMAIN\` is optional. Windows user names are case insensitive. Additionally, there are some restrictions regarding the `DOMAIN` and `USER`:
187+
In order to use this feature, the value set in the `runAsUserName` field must be a valid username.
188+
It must have the following format: `DOMAIN\USER`, where `DOMAIN\` is optional. Windows user names
189+
are case insensitive. Additionally, there are some restrictions regarding the `DOMAIN` and `USER`:
188190
-->
189191
## Windows Username 的局限性 {#windows-username-limitations}
190192

@@ -203,7 +205,7 @@ Windows 用户名不区分大小写。此外,关于 `DOMAIN` 和 `USER` 还有
203205
- `DOMAIN` 必须是 NetBios 名称或 DNS 名称,每种名称都有各自的局限性:
204206
- NetBios 名称:最多 15 个字符,不能以 `.`(点)开头,并且不能包含以下字符:`\ / : * ? " < > |`
205207
- DNS 名称:最多 255 个字符,只能包含字母、数字、点和中划线,并且不能以 `.`(点)或 `-`(中划线)开头和结尾。
206-
- `USER` 最多不超过 20 个字符,不能 **** 包含点或空格,并且不能包含以下字符:`" / \ [ ] : ; | = , + * ? < > @`
208+
- `USER` 最多不超过 20 个字符,不能****包含点或空格,并且不能包含以下字符:`" / \ [ ] : ; | = , + * ? < > @`
207209

208210
<!--
209211
Examples of acceptable values for the `runAsUserName` field: `ContainerAdministrator`, `ContainerUser`, `NT AUTHORITY\NETWORK SERVICE`, `NT AUTHORITY\LOCAL SERVICE`.
@@ -224,4 +226,4 @@ For more information about these limtations, check [here](https://support.micros
224226
-->
225227
* [Kubernetes 中调度 Windows 容器的指南](/zh-cn/docs/concepts/windows/user-guide/)
226228
* [使用组托管服务帐户(GMSA)管理工作负载身份](/zh-cn/docs/concepts/windows/user-guide/#managing-workload-identity-with-group-managed-service-accounts)
227-
* [Windows 下 pod 和容器的 GMSA 配置](/zh-cn/docs/tasks/configure-pod-container/configure-gmsa/)
229+
* [Windows 下 Pod 和容器的 GMSA 配置](/zh-cn/docs/tasks/configure-pod-container/configure-gmsa/)

content/zh-cn/docs/tasks/configure-pod-container/configure-service-account.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,15 @@ kubectl get pods/<podname> -o yaml
8383

8484
<!--
8585
In the output, you see a field `spec.serviceAccountName`.
86-
Kubernetes [automatically](/docs/concepts/overview/working-with-objects/object-management/)
86+
Kubernetes automatically
8787
sets that value if you don't specify it when you create a Pod.
8888
8989
An application running inside a Pod can access the Kubernetes API using
9090
automatically mounted service account credentials.
9191
See [accessing the Cluster](/docs/tasks/access-application-cluster/access-cluster/) to learn more.
9292
-->
9393
在输出中,你可以看到字段 `spec.serviceAccountName`。当你在创建 Pod 时未设置该字段时,
94-
Kubernetes [自动](/zh-cn/docs/concepts/overview/working-with-objects/object-management/)
95-
Pod 设置这一属性的取值。
94+
Kubernetes 自动为 Pod 设置这一属性的取值。
9695

9796
Pod 中运行的应用可以使用这一自动挂载的服务账号凭据来访问 Kubernetes API。
9897
参阅[访问集群](/zh-cn/docs/tasks/access-application-cluster/access-cluster/)以进一步了解。
@@ -657,7 +656,7 @@ of two hours, you could define a Pod manifest that is similar to:
657656
要为某 Pod 提供一个受众为 `vault` 并且有效期限为 2 小时的令牌,你可以定义一个与下面类似的
658657
Pod 清单:
659658
660-
{{% code file="pods/pod-projected-svc-token.yaml" %}}
659+
{{% code_sample file="pods/pod-projected-svc-token.yaml" %}}
661660
662661
<!--
663662
Create the Pod:

content/zh-cn/docs/tasks/configure-pod-container/configure-volume-storage.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ restarts. Here is the configuration file for the Pod:
4646
[emptyDir](/zh-cn/docs/concepts/storage/volumes/#emptydir) 的卷,
4747
在整个 Pod 生命周期中一直存在,即使 Pod 中的容器被终止和重启。以下是 Pod 的配置:
4848

49-
{{% code file="pods/storage/redis.yaml" %}}
49+
{{% code_sample file="pods/storage/redis.yaml" %}}
5050

5151
<!--
5252
1. Create the Pod:

content/zh-cn/docs/tasks/configure-pod-container/extended-resource.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Here is the configuration file for a Pod that has one Container:
5454

5555
下面是包含一个容器的 Pod 配置文件:
5656

57-
{{% code file="pods/resource/extended-resource-pod.yaml" %}}
57+
{{% code_sample file="pods/resource/extended-resource-pod.yaml" %}}
5858

5959
<!--
6060
In the configuration file, you can see that the Container requests 3 dongles.
@@ -109,7 +109,7 @@ two dongles.
109109
110110
下面是包含一个容器的 Pod 配置文件,容器请求了 2 个 dongles。
111111
112-
{{% code file="pods/resource/extended-resource-pod-2.yaml" %}}
112+
{{% code_sample file="pods/resource/extended-resource-pod-2.yaml" %}}
113113
114114
<!--
115115
Kubernetes will not be able to satisfy the request for two dongles, because the first Pod

content/zh-cn/docs/tasks/configure-pod-container/pull-image-private-registry.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ Here is a manifest for an example Pod that needs access to your Docker credentia
313313

314314
下面是一个 Pod 配置清单示例,该示例中 Pod 需要访问你的 Docker 凭据 `regcred`:
315315

316-
{{% code file="pods/private-reg-pod.yaml" %}}
316+
{{% code_sample file="pods/private-reg-pod.yaml" %}}
317317

318318
<!--
319319
Download the above file onto your computer:

content/zh-cn/docs/tasks/configure-pod-container/quality-service-pod.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ memory request, both equal to 200 MiB. The Container has a CPU limit and a CPU r
9595
下面是包含一个 Container 的 Pod 清单。该 Container 设置了内存请求和内存限制,值都是 200 MiB。
9696
该 Container 设置了 CPU 请求和 CPU 限制,值都是 700 milliCPU:
9797

98-
{{% code file="pods/qos/qos-pod.yaml" %}}
98+
{{% code_sample file="pods/qos/qos-pod.yaml" %}}
9999

100100
<!--
101101
Create the Pod:
@@ -186,7 +186,7 @@ and a memory request of 100 MiB.
186186
下面是包含一个 Container 的 Pod 清单。该 Container 设置的内存限制为 200 MiB,
187187
内存请求为 100 MiB。
188188

189-
{{% code file="pods/qos/qos-pod-2.yaml" %}}
189+
{{% code_sample file="pods/qos/qos-pod-2.yaml" %}}
190190

191191
<!--
192192
Create the Pod:
@@ -209,7 +209,7 @@ kubectl get pod qos-demo-2 --namespace=qos-example --output=yaml
209209
<!--
210210
The output shows that Kubernetes gave the Pod a QoS class of `Burstable`:
211211
-->
212-
结果表明 Kubernetes 为 Pod 配置的 QoS 类为 `Burstable`
212+
结果表明 Kubernetes 为 Pod 配置的 QoS 类为 `Burstable`
213213

214214
```yaml
215215
spec:
@@ -256,7 +256,7 @@ limits or requests:
256256

257257
下面是包含一个 Container 的 Pod 清单。该 Container 没有设置内存和 CPU 限制或请求。
258258

259-
{{% code file="pods/qos/qos-pod-3.yaml" %}}
259+
{{% code_sample file="pods/qos/qos-pod-3.yaml" %}}
260260

261261
<!--
262262
Create the Pod:
@@ -316,7 +316,7 @@ request of 200 MiB. The other Container does not specify any requests or limits.
316316
下面是包含两个 Container 的 Pod 清单。一个 Container 指定内存请求为 200 MiB。
317317
另外一个 Container 没有指定任何请求或限制。
318318

319-
{{% code file="pods/qos/qos-pod-4.yaml" %}}
319+
{{% code_sample file="pods/qos/qos-pod-4.yaml" %}}
320320

321321
<!--
322322
Notice that this Pod meets the criteria for QoS class `Burstable`. That is, it does not meet the

content/zh-cn/docs/tasks/configure-pod-container/resize-container-resources.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ Consider the following manifest for a Pod that has one Container.
166166
167167
考虑以下包含一个容器的 Pod 的清单。
168168
169-
{{% code file="pods/qos/qos-pod-5.yaml" %}}
169+
{{% code_sample file="pods/qos/qos-pod-5.yaml" %}}
170170
171171
<!--
172172
Create the pod in the `qos-example` namespace:

content/zh-cn/docs/tasks/configure-pod-container/security-context.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ Here is a configuration file for a Pod that has a `securityContext` and an `empt
108108
对象。你为 Pod 所设置的安全性配置会应用到 Pod 中所有 Container 上。
109109
下面是一个 Pod 的配置文件,该 Pod 定义了 `securityContext` 和一个 `emptyDir` 卷:
110110

111-
{{% code file="pods/security/security-context.yaml" %}}
111+
{{% code_sample file="pods/security/security-context.yaml" %}}
112112

113113
<!--
114114
In the configuration file, the `runAsUser` field specifies that for any Containers in
@@ -371,7 +371,7 @@ Pod 层面设置的内容发生重叠时,会重写 Pod 层面的设置。Conta
371371
下面是一个 Pod 的配置文件,其中包含一个 Container。Pod 和 Container 都有
372372
`securityContext` 字段:
373373

374-
{{% code file="pods/security/security-context-2.yaml" %}}
374+
{{% code_sample file="pods/security/security-context-2.yaml" %}}
375375

376376
<!--
377377
Create the Pod:
@@ -454,7 +454,7 @@ Here is configuration file that does not add or remove any Container capabilitie
454454
首先,看一下不包含 `capabilities` 字段时候会发生什么。
455455
下面是一个配置文件,其中没有添加或移除容器的权能:
456456

457-
{{% code file="pods/security/security-context-3.yaml" %}}
457+
{{% code_sample file="pods/security/security-context-3.yaml" %}}
458458

459459
<!--
460460
Create the Pod:
@@ -546,7 +546,7 @@ adds the `CAP_NET_ADMIN` and `CAP_SYS_TIME` capabilities:
546546
下面是一个 Pod 的配置,其中运行一个容器。配置为容器添加 `CAP_NET_ADMIN`
547547
`CAP_SYS_TIME` 权能:
548548

549-
{{% code file="pods/security/security-context-4.yaml" %}}
549+
{{% code_sample file="pods/security/security-context-4.yaml" %}}
550550

551551
<!--
552552
Create the Pod:

content/zh-cn/docs/tasks/configure-pod-container/share-process-namespace.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Process namespace sharing is enabled using the `shareProcessNamespace` field of
5050
-->
5151
使用 Pod `.spec` 中的 `shareProcessNamespace` 字段可以启用进程命名空间共享。例如:
5252

53-
{{% code file="pods/share-process-namespace.yaml" %}}
53+
{{% code_sample file="pods/share-process-namespace.yaml" %}}
5454

5555
<!--
5656
1. Create the pod `nginx` on your cluster:
@@ -208,4 +208,3 @@ Pod 共享许多资源,因此它们共享进程命名空间是很有意义的
208208
-->
209209
3. **容器文件系统通过 `/proc/$pid/root` 链接对 Pod 中的其他容器可见。** 这使调试更加容易,
210210
但也意味着文件系统安全性只受文件系统权限的保护。
211-

0 commit comments

Comments
 (0)