Skip to content

Commit 498bcd3

Browse files
authored
Merge pull request #33698 from my-git9/mygit15
[zh] adjust get-shell-running-container.md
2 parents 2aace49 + 6389a03 commit 498bcd3

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

content/zh/docs/tasks/debug/debug-application/get-shell-running-container.md

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,19 @@ running Container.
2020
<!--
2121
## Getting a shell to a Container
2222
-->
23-
2423
## 获取容器的 Shell
2524

2625
<!--
2726
In this exercise, you create a Pod that has one Container. The Container
2827
runs the nginx image. Here is the configuration file for the Pod:
2928
-->
30-
3129
在本练习中,你将创建包含一个容器的 Pod。容器运行 nginx 镜像。下面是 Pod 的配置文件:
3230

3331
{{< codenew file="application/shell-demo.yaml" >}}
3432

3533
<!--
3634
Create the Pod:
3735
-->
38-
3936
创建 Pod:
4037

4138
```shell
@@ -45,7 +42,6 @@ kubectl create -f https://k8s.io/examples/application/shell-demo.yaml
4542
<!--
4643
Verify that the Container is running:
4744
-->
48-
4945
检查容器是否运行正常:
5046

5147
```shell
@@ -55,7 +51,6 @@ kubectl get pod shell-demo
5551
<!--
5652
Get a shell to the running Container:
5753
-->
58-
5954
获取正在运行容器的 Shell:
6055

6156
```shell
@@ -72,7 +67,6 @@ The double dash symbol "--" is used to separate the arguments you want to pass t
7267
<!--
7368
In your shell, list the root directory:
7469
-->
75-
7670
在 shell 中,打印根目录:
7771

7872
```shell
@@ -83,7 +77,6 @@ root@shell-demo:/# ls /
8377
In your shell, experiment with other commands. Here are
8478
some examples:
8579
-->
86-
8780
在 shell 中,实验其他命令。下面是一些示例:
8881

8982
```shell
@@ -103,22 +96,19 @@ root@shell-demo:/# ps aux | grep nginx
10396
<!--
10497
## Writing the root page for nginx
10598
-->
106-
10799
## 编写 nginx 的根页面
108100

109101
<!--
110102
Look again at the configuration file for your Pod. The Pod
111103
has an `emptyDir` volume, and the Container mounts the volume
112104
at `/usr/share/nginx/html`.
113105
-->
114-
115-
在看一下 Pod 的配置文件。该 Pod 有个 `emptyDir` 卷,容器将该卷挂载到了 `/usr/share/nginx/html`
106+
再看一下 Pod 的配置文件。该 Pod 有个 `emptyDir` 卷,容器将该卷挂载到了 `/usr/share/nginx/html`
116107

117108
<!--
118109
In your shell, create an `index.html` file in the `/usr/share/nginx/html`
119110
directory:
120111
-->
121-
122112
在 shell 中,在 `/usr/share/nginx/html` 目录创建一个 `index.html` 文件:
123113

124114
```shell
@@ -128,7 +118,6 @@ root@shell-demo:/# echo Hello shell demo > /usr/share/nginx/html/index.html
128118
<!--
129119
In your shell, send a GET request to the nginx server:
130120
-->
131-
132121
在 shell 中,向 nginx 服务器发送 GET 请求:
133122

134123
```shell
@@ -140,7 +129,6 @@ root@shell-demo:/# curl localhost
140129
<!--
141130
The output shows the text that you wrote to the `index.html` file:
142131
-->
143-
144132
输出结果显示了你在 `index.html` 中写入的文本。
145133

146134
```shell
@@ -150,20 +138,17 @@ Hello shell demo
150138
<!--
151139
When you are finished with your shell, enter `exit`.
152140
-->
153-
154141
当用完 shell 后,输入 `exit` 退出。
155142

156143
<!--
157144
## Running individual commands in a Container
158145
-->
159-
160146
## 在容器中运行单个命令
161147

162148
<!--
163149
In an ordinary command window, not your shell, list the environment
164150
variables in the running Container:
165151
-->
166-
167152
在普通的命令窗口(而不是 shell)中,打印环境运行容器中的变量:
168153

169154
```shell
@@ -173,7 +158,6 @@ kubectl exec shell-demo env
173158
<!--
174159
Experiment running other commands. Here are some examples:
175160
-->
176-
177161
实验运行其他命令。下面是一些示例:
178162

179163
```shell
@@ -187,7 +171,6 @@ kubectl exec shell-demo cat /proc/1/mounts
187171
<!--
188172
## Opening a shell when a Pod has more than one Container
189173
-->
190-
191174
## 当 Pod 包含多个容器时打开 shell
192175

193176
<!--
@@ -197,9 +180,8 @@ suppose you have a Pod named my-pod, and the Pod has two containers
197180
named main-app and helper-app. The following command would open a
198181
shell to the main-app Container.
199182
-->
200-
201183
如果 Pod 有多个容器,`--container` 或者 `-c` 可以在 `kubectl exec` 命令中指定容器。
202-
例如,您有个名为 my-pod 的容器,该 Pod 有两个容器分别为 main-app 和 healper-app。
184+
例如,你有个名为 my-pod 的 Pod,该 Pod 有两个容器分别为 main-app 和 healper-app。
203185
下面的命令将会打开一个 shell 访问 main-app 容器。
204186

205187
```shell

0 commit comments

Comments
 (0)