committed by
Kubernetes Prow Robot
parent
0268ed0c18
commit
b05129acc3
@@ -56,7 +56,7 @@ content_template: templates/task
|
||||
```
|
||||
|
||||
日志中显示了HOSTNAME 与KUBERNETES_PORT 这两个环境变量的值:
|
||||
|
||||
|
||||
```
|
||||
command-demo
|
||||
tcp://10.3.240.1:443
|
||||
@@ -81,7 +81,7 @@ args: ["$(MESSAGE)"]
|
||||
[Secrets](/docs/concepts/configuration/secret/).
|
||||
|
||||
{{< note >}}
|
||||
**注意:** 环境变量需要加上括号,类似于`"$(VAR)"`。这是在`command`
|
||||
**注意:** 环境变量需要加上括号,类似于`"$(VAR)"`。这是在`command`
|
||||
或 `args`字段使用变量的格式要求。
|
||||
{{< /note >}}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ base-64 形式的密码为 `Mzk1MjgkdmRnN0pi`。
|
||||
|
||||
```shell
|
||||
kubectl create -f https://k8s.io/examples/pods/inject/secret.yaml
|
||||
```
|
||||
```
|
||||
|
||||
{{< note >}}
|
||||
**注意:** 如果想要跳过 Base64 编码的步骤,可以使用 `kubectl create secret` 命令来创建 Secret:
|
||||
@@ -105,7 +105,7 @@ base-64 形式的密码为 `Mzk1MjgkdmRnN0pi`。
|
||||
```
|
||||
|
||||
1. 在 Pod 中运行的容器中获取一个 shell:
|
||||
|
||||
|
||||
```shell
|
||||
kubectl exec -it secret-test-pod -- /bin/bash
|
||||
```
|
||||
@@ -117,7 +117,7 @@ base-64 形式的密码为 `Mzk1MjgkdmRnN0pi`。
|
||||
root@secret-test-pod:/# cd /etc/secret-volume
|
||||
```
|
||||
1. 在 shell 中,列出 `/etc/secret-volume` 目录的文件:
|
||||
|
||||
|
||||
```shell
|
||||
root@secret-test-pod:/etc/secret-volume# ls
|
||||
```
|
||||
@@ -154,26 +154,26 @@ base-64 形式的密码为 `Mzk1MjgkdmRnN0pi`。
|
||||
```
|
||||
|
||||
1. 确认 Pod 正在运行:
|
||||
|
||||
|
||||
```shell
|
||||
kubectl get pod secret-envars-test-pod
|
||||
```
|
||||
|
||||
输出:
|
||||
|
||||
|
||||
```shell
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
secret-envars-test-pod 1/1 Running 0 4m
|
||||
```
|
||||
|
||||
1. 在 Pod 中运行的容器中获取一个 shell:
|
||||
|
||||
|
||||
```shell
|
||||
kubectl exec -it secret-envars-test-pod -- /bin/bash
|
||||
```
|
||||
|
||||
1. 在 shell 中,显示环境变量:
|
||||
|
||||
|
||||
```shell
|
||||
root@secret-envars-test-pod:/# printenv
|
||||
```
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ content_template: templates/task
|
||||
第二个元素指示Pod的`annotations`字段的值保存在名为`annotations`的文件中。
|
||||
|
||||
{{< note >}}
|
||||
**注意:** 本示例中的字段是Pod字段,不是Pod中容器的字段。
|
||||
**注意:** 本示例中的字段是Pod字段,不是Pod中容器的字段。
|
||||
{{< /note >}}
|
||||
|
||||
创建 Pod:
|
||||
|
||||
@@ -4,7 +4,7 @@ approvers:
|
||||
title: 使用 PodPreset 将信息注入 Pods
|
||||
---
|
||||
|
||||
在 pod 创建时,用户可以使用 `podpreset` 对象将 secrets、卷挂载和环境变量等信息注入其中。
|
||||
在 pod 创建时,用户可以使用 `podpreset` 对象将 secrets、卷挂载和环境变量等信息注入其中。
|
||||
本文展示了一些 `PodPreset` 资源使用的示例。
|
||||
用户可以从[理解 Pod Presets](/docs/concepts/workloads/pods/podpreset/) 中了解 PodPresets 的整体情况。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user