Fixed formatting for markdown file (#12192)
* Fixed formatting for markdown file File updated: define-environment-variable-container.md Language: zh * Fixes to markdown formattingpull/12197/head
parent
3466056184
commit
5c56b43456
|
@ -30,32 +30,44 @@ content_template: templates/task
|
||||||
|
|
||||||
1. 基于YAML文件创建一个Pod:
|
1. 基于YAML文件创建一个Pod:
|
||||||
|
|
||||||
|
```shell
|
||||||
kubectl create -f https://k8s.io/docs/tasks/inject-data-application/envars.yaml
|
kubectl create -f https://k8s.io/docs/tasks/inject-data-application/envars.yaml
|
||||||
|
```
|
||||||
|
|
||||||
1. 获取一下当前正在运行的Pods信息:
|
1. 获取一下当前正在运行的Pods信息:
|
||||||
|
|
||||||
|
```shell
|
||||||
kubectl get pods -l purpose=demonstrate-envars
|
kubectl get pods -l purpose=demonstrate-envars
|
||||||
|
```
|
||||||
|
|
||||||
查询结果应为:
|
查询结果应为:
|
||||||
|
|
||||||
|
```log
|
||||||
NAME READY STATUS RESTARTS AGE
|
NAME READY STATUS RESTARTS AGE
|
||||||
envar-demo 1/1 Running 0 9s
|
envar-demo 1/1 Running 0 9s
|
||||||
|
```
|
||||||
|
|
||||||
1. 进入该Pod下的容器并打开一个命令终端:
|
1. 进入该Pod下的容器并打开一个命令终端:
|
||||||
|
|
||||||
|
```shell
|
||||||
kubectl exec -it envar-demo -- /bin/bash
|
kubectl exec -it envar-demo -- /bin/bash
|
||||||
|
```
|
||||||
|
|
||||||
1. 在命令终端中通过执行`printenv`打印出环境变量。
|
1. 在命令终端中通过执行`printenv`打印出环境变量。
|
||||||
|
|
||||||
|
```shell
|
||||||
root@envar-demo:/# printenv
|
root@envar-demo:/# printenv
|
||||||
|
```
|
||||||
|
|
||||||
打印结果应为:
|
打印结果应为:
|
||||||
|
|
||||||
|
```log
|
||||||
NODE_VERSION=4.4.2
|
NODE_VERSION=4.4.2
|
||||||
EXAMPLE_SERVICE_PORT_8080_TCP_ADDR=10.3.245.237
|
EXAMPLE_SERVICE_PORT_8080_TCP_ADDR=10.3.245.237
|
||||||
HOSTNAME=envar-demo
|
HOSTNAME=envar-demo
|
||||||
...
|
...
|
||||||
DEMO_GREETING=Hello from the environment
|
DEMO_GREETING=Hello from the environment
|
||||||
|
```
|
||||||
|
|
||||||
1. 通过键入`exit`退出命令终端。
|
1. 通过键入`exit`退出命令终端。
|
||||||
|
|
||||||
|
|
|
@ -201,5 +201,3 @@ base-64 形式的密码为 `Mzk1MjgkdmRnN0pi`。
|
||||||
* [Pod](/docs/api-reference/{{< param "version" >}}/#pod-v1-core)
|
* [Pod](/docs/api-reference/{{< param "version" >}}/#pod-v1-core)
|
||||||
|
|
||||||
{{% /capture %}}
|
{{% /capture %}}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue