Fixed formatting for markdown file (#12192)

* Fixed formatting for markdown file

File updated: define-environment-variable-container.md
Language: zh

* Fixes to markdown formatting
This commit is contained in:
Roy Lenferink
2019-01-13 09:40:55 +01:00
committed by Kubernetes Prow Robot
parent 3466056184
commit 5c56b43456
2 changed files with 55 additions and 45 deletions
@@ -21,8 +21,8 @@ content_template: templates/task
`39528$vdg7Jb`。 首先使用 [Base64 编码](https://www.base64encode.org/) 将用户名和密码转化为 base-64 形式。 这里是一个 Linux 示例:
```shell
echo -n 'my-app' | base64
echo -n '39528$vdg7Jb' | base64
echo -n 'my-app' | base64
echo -n '39528$vdg7Jb' | base64
```
结果显示 base-64 形式的用户名为 `bXktYXBw`
@@ -66,17 +66,17 @@ base-64 形式的密码为 `Mzk1MjgkdmRnN0pi`。
输出:
```shell
Name: test-secret
Namespace: default
Labels: <none>
Annotations: <none>
Name: test-secret
Namespace: default
Labels: <none>
Annotations: <none>
Type: Opaque
Type: Opaque
Data
====
password: 13 bytes
username: 7 bytes
Data
====
password: 13 bytes
username: 7 bytes
```
## 创建可以通过卷访问 secret 数据的 Pod
@@ -88,57 +88,57 @@ base-64 形式的密码为 `Mzk1MjgkdmRnN0pi`。
1. 创建 Pod
```shell
kubectl create -f secret-pod.yaml
kubectl create -f secret-pod.yaml
```
1. 确认 Pod 正在运行:
```shell
kubectl get pod secret-test-pod
kubectl get pod secret-test-pod
```
输出:
```shell
NAME READY STATUS RESTARTS AGE
secret-test-pod 1/1 Running 0 42m
NAME READY STATUS RESTARTS AGE
secret-test-pod 1/1 Running 0 42m
```
1. 在 Pod 中运行的容器中获取一个 shell:
```shell
kubectl exec -it secret-test-pod -- /bin/bash
kubectl exec -it secret-test-pod -- /bin/bash
```
1. secret 数据通过挂载在 `/etc/secret-volume` 目录下的卷暴露在容器中。
在 shell 中,进入 secret 数据被暴露的目录:
```shell
root@secret-test-pod:/# cd /etc/secret-volume
root@secret-test-pod:/# cd /etc/secret-volume
```
1. 在 shell 中,列出 `/etc/secret-volume` 目录的文件:
```shell
root@secret-test-pod:/etc/secret-volume# ls
root@secret-test-pod:/etc/secret-volume# ls
```
输出显示了两个文件,每个对应一条 secret 数据:
```shell
password username
password username
```
1. 在 shell 中,显示 `username` 和 `password` 文件的内容:
```shell
root@secret-test-pod:/etc/secret-volume# cat username; echo; cat password; echo
root@secret-test-pod:/etc/secret-volume# cat username; echo; cat password; echo
```
输出为用户名和密码:
```shell
my-app
39528$vdg7Jb
my-app
39528$vdg7Jb
```
## 创建通过环境变量访问 secret 数据的 Pod
@@ -150,41 +150,41 @@ base-64 形式的密码为 `Mzk1MjgkdmRnN0pi`。
1. 创建 Pod
```shell
kubectl create -f https://k8s.io/examples/pods/inject/secret-envars-pod.yaml
kubectl create -f https://k8s.io/examples/pods/inject/secret-envars-pod.yaml
```
1. 确认 Pod 正在运行:
```shell
kubectl get pod secret-envars-test-pod
kubectl get pod secret-envars-test-pod
```
输出:
```shell
NAME READY STATUS RESTARTS AGE
secret-envars-test-pod 1/1 Running 0 4m
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
kubectl exec -it secret-envars-test-pod -- /bin/bash
```
1. 在 shell 中,显示环境变量:
```shell
root@secret-envars-test-pod:/# printenv
root@secret-envars-test-pod:/# printenv
```
输出包括用户名和密码:
```shell
...
SECRET_USERNAME=my-app
...
SECRET_PASSWORD=39528$vdg7Jb
...
SECRET_USERNAME=my-app
...
SECRET_PASSWORD=39528$vdg7Jb
```
{{% /capture %}}
@@ -201,5 +201,3 @@ base-64 形式的密码为 `Mzk1MjgkdmRnN0pi`。
* [Pod](/docs/api-reference/{{< param "version" >}}/#pod-v1-core)
{{% /capture %}}