@@ -269,13 +269,13 @@ When you deploy this Pod, the following happens:
269
269
当你部署此 Pod 时,会发生以下情况:
270
270
271
271
<!--
272
- * The ` username` key from `mysecret` is available to the container at the path
272
+ - The ` username` key from `mysecret` is available to the container at the path
273
273
` /etc/foo/my-group/my-username` instead of at `/etc/foo/username`.
274
- * The `password` key from that Secret object is not projected.
274
+ - The `password` key from that Secret object is not projected.
275
275
-->
276
- * 来自 `mysecret` 的键 `username` 可以在路径 `/etc/foo/my-group/my-username`
276
+ - 来自 `mysecret` 的键 `username` 可以在路径 `/etc/foo/my-group/my-username`
277
277
下供容器使用,而不是路径 `/etc/foo/username`。
278
- * 来自该 Secret 的键 `password` 没有映射到任何路径。
278
+ - 来自该 Secret 的键 `password` 没有映射到任何路径。
279
279
280
280
<!--
281
281
If you list keys explicitly using `.spec.volumes[].secret.items`, consider the
@@ -285,15 +285,15 @@ following:
285
285
如果你使用 `.spec.volumes[].secret.items` 明确地列出键,请考虑以下事项:
286
286
287
287
<!--
288
- * Only keys specified in `items` are projected.
289
- * To consume all keys from the Secret, all of them must be listed in the
288
+ - Only keys specified in `items` are projected.
289
+ - To consume all keys from the Secret, all of them must be listed in the
290
290
` items` field.
291
- * All listed keys must exist in the corresponding Secret. Otherwise, the volume
291
+ - All listed keys must exist in the corresponding Secret. Otherwise, the volume
292
292
is not created.
293
293
-->
294
- * 只有在 `items` 字段中指定的键才会被映射。
295
- * 要使用 Secret 中全部的键,那么全部的键都必须列在 `items` 字段中。
296
- * 所有列出的键必须存在于相应的 Secret 中。否则,该卷不被创建。
294
+ - 只有在 `items` 字段中指定的键才会被映射。
295
+ - 要使用 Secret 中全部的键,那么全部的键都必须列在 `items` 字段中。
296
+ - 所有列出的键必须存在于相应的 Secret 中。否则,该卷不被创建。
297
297
298
298
<!--
299
299
# ## Set POSIX permissions for Secret keys
@@ -379,34 +379,34 @@ secrets change.
379
379
# ## 使用来自 Secret 中的数据定义容器变量 {#define-a-container-env-var-with-data-from-a-single-secret}
380
380
381
381
<!--
382
- * Define an environment variable as a key-value pair in a Secret:
382
+ - Define an environment variable as a key-value pair in a Secret :
383
383
-->
384
- * 定义环境变量为 Secret 中的键值偶对:
384
+ - 定义环境变量为 Secret 中的键值偶对:
385
385
386
386
` ` ` shell
387
387
kubectl create secret generic backend-user --from-literal=backend-username='backend-admin'
388
388
` ` `
389
389
390
390
<!--
391
- * Assign the `backend-username` value defined in the Secret to the `SECRET_USERNAME` environment variable in the Pod specification.
391
+ - Assign the `backend-username` value defined in the Secret to the `SECRET_USERNAME` environment variable in the Pod specification.
392
392
-->
393
- * 在 Pod 规约中,将 Secret 中定义的值 `backend-username` 赋给 `SECRET_USERNAME` 环境变量。
393
+ - 在 Pod 规约中,将 Secret 中定义的值 `backend-username` 赋给 `SECRET_USERNAME` 环境变量。
394
394
395
395
{{< codenew file="pods/inject/pod-single-secret-env-variable.yaml" >}}
396
396
397
397
<!--
398
- * Create the Pod:
398
+ - Create the Pod :
399
399
-->
400
- * 创建 Pod:
400
+ - 创建 Pod:
401
401
402
402
` ` ` shell
403
403
kubectl create -f https://k8s.io/examples/pods/inject/pod-single-secret-env-variable.yaml
404
404
` ` `
405
405
406
406
<!--
407
- * In your shell, display the content of `SECRET_USERNAME` container environment variable
407
+ - In your shell, display the content of `SECRET_USERNAME` container environment variable
408
408
-->
409
- * 在 Shell 中,显示容器环境变量 `SECRET_USERNAME` 的内容:
409
+ - 在 Shell 中,显示容器环境变量 `SECRET_USERNAME` 的内容:
410
410
411
411
` ` ` shell
412
412
kubectl exec -i -t env-single-secret -- /bin/sh -c 'echo $SECRET_USERNAME'
@@ -426,35 +426,35 @@ secrets change.
426
426
### 使用来自多个 Secret 的数据定义环境变量 {#define-container-env-var-with-data-from-multi-secrets}
427
427
428
428
<!--
429
- * As with the previous example, create the Secrets first.
429
+ - As with the previous example, create the Secrets first.
430
430
-->
431
- * 和前面的例子一样,先创建 Secret:
431
+ - 和前面的例子一样,先创建 Secret:
432
432
433
433
```shell
434
434
kubectl create secret generic backend-user --from-literal=backend-username='backend-admin'
435
435
kubectl create secret generic db-user --from-literal=db-username='db-admin'
436
436
```
437
437
438
438
<!--
439
- * Define the environment variables in the Pod specification.
439
+ - Define the environment variables in the Pod specification.
440
440
-->
441
- * 在 Pod 规约中定义环境变量:
441
+ - 在 Pod 规约中定义环境变量:
442
442
443
443
{{< codenew file="pods/inject/pod-multiple-secret-env-variable.yaml" >}}
444
444
445
445
<!--
446
- * Create the Pod:
446
+ - Create the Pod:
447
447
-->
448
- * 创建 Pod:
448
+ - 创建 Pod:
449
449
450
450
``` shell
451
451
kubectl create -f https://k8s.io/examples/pods/inject/pod-multiple-secret-env-variable.yaml
452
452
```
453
453
454
454
<!--
455
- * In your shell, display the container environment variables
455
+ - In your shell, display the container environment variables
456
456
-->
457
- * 在你的 Shell 中,显示容器环境变量的内容:
457
+ - 在你的 Shell 中,显示容器环境变量的内容:
458
458
459
459
``` shell
460
460
kubectl exec -i -t envvars-multiple-secrets -- /bin/sh -c ' env | grep _USERNAME'
@@ -481,35 +481,35 @@ This functionality is available in Kubernetes v1.6 and later.
481
481
{{< /note >}}
482
482
483
483
<!--
484
- * Create a Secret containing multiple key-value pairs
484
+ - Create a Secret containing multiple key-value pairs
485
485
-->
486
- * 创建包含多个键值偶对的 Secret:
486
+ - 创建包含多个键值偶对的 Secret:
487
487
488
488
``` shell
489
489
kubectl create secret generic test-secret --from-literal=username=' my-app' --from-literal=password=' 39528$vdg7Jb'
490
490
```
491
491
492
492
<!--
493
- * Use envFrom to define all of the Secret's data as container environment variables. The key from the Secret becomes the environment variable name in the Pod.
493
+ - Use envFrom to define all of the Secret's data as container environment variables. The key from the Secret becomes the environment variable name in the Pod.
494
494
-->
495
- * 使用 ` envFrom ` 来将 Secret 中的所有数据定义为环境变量。
495
+ - 使用 ` envFrom ` 来将 Secret 中的所有数据定义为环境变量。
496
496
Secret 中的键名成为容器中的环境变量名:
497
497
498
498
{{< codenew file="pods/inject/pod-secret-envFrom.yaml" >}}
499
499
500
500
<!--
501
- * Create the Pod:
501
+ - Create the Pod:
502
502
-->
503
- * 创建 Pod:
503
+ - 创建 Pod:
504
504
505
505
``` shell
506
506
kubectl create -f https://k8s.io/examples/pods/inject/pod-secret-envFrom.yaml
507
507
```
508
508
509
509
<!--
510
- * In your shell, display `username` and `password` container environment variables
510
+ - In your shell, display `username` and `password` container environment variables
511
511
-->
512
- * 在 Shell 中,显示环境变量 ` username ` 和 ` password ` 的内容:
512
+ - 在 Shell 中,显示环境变量 ` username ` 和 ` password ` 的内容:
513
513
514
514
``` shell
515
515
kubectl exec -i -t envfrom-secret -- /bin/sh -c ' echo "username: $username\npassword: $password\n"'
@@ -530,15 +530,15 @@ This functionality is available in Kubernetes v1.6 and later.
530
530
-->
531
531
### 参考 {#references}
532
532
533
- * [ Secret] (/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#secret-v1-core)
534
- * [ Volume] (/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#volume-v1-core)
535
- * [ Pod] (/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#pod-v1-core)
533
+ - [ Secret] (/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#secret-v1-core)
534
+ - [ Volume] (/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#volume-v1-core)
535
+ - [ Pod] (/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#pod-v1-core)
536
536
537
537
## {{% heading "whatsnext" %}}
538
538
539
539
<!--
540
- * Learn more about [Secrets](/docs/concepts/configuration/secret/).
541
- * Learn about [Volumes](/docs/concepts/storage/volumes/).
540
+ - Learn more about [Secrets](/docs/concepts/configuration/secret/).
541
+ - Learn about [Volumes](/docs/concepts/storage/volumes/).
542
542
-->
543
- * 进一步了解 [ Secret] ( /zh-cn/docs/concepts/configuration/secret/ ) 。
544
- * 了解[ 卷] ( /zh-cn/docs/concepts/storage/volumes/ ) 。
543
+ - 进一步了解 [ Secret] ( /zh-cn/docs/concepts/configuration/secret/ ) 。
544
+ - 了解[ 卷] ( /zh-cn/docs/concepts/storage/volumes/ ) 。
0 commit comments