Skip to content

Commit 13196e1

Browse files
committed
[zh-cn]sync and improve docker-cli-to-kubectl node-conformance
Signed-off-by: xin.li <[email protected]>
1 parent 17119b9 commit 13196e1

File tree

2 files changed

+57
-49
lines changed

2 files changed

+57
-49
lines changed

content/zh-cn/docs/reference/kubectl/docker-cli-to-kubectl.md

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ To run an nginx Deployment and expose the Deployment, see [kubectl create deploy
3131
<!--
3232
docker:
3333
-->
34-
使用 Docker 命令:
34+
使用 docker 命令:
3535

3636
```shell
3737
docker run -d --restart=always -e DOMAIN=cluster --name nginx-app -p 80:80 nginx
@@ -79,7 +79,7 @@ deployment.apps/nginx-app env updated
7979
<!--
8080
`kubectl` commands print the type and name of the resource created or mutated, which can then be used in subsequent commands. You can expose a new Service after a Deployment is created.
8181
-->
82-
`kubectl` 命令打印创建或突变资源的类型和名称,然后可以在后续命令中使用。部署后,你可以公开新服务
82+
`kubectl` 命令打印创建或突变资源的类型和名称,然后可以在后续命令中使用。部署后,你可以公开新的 Service
8383
{{< /note >}}
8484

8585
<!--
@@ -89,7 +89,7 @@ kubectl expose deployment nginx-app --port=80 --name=nginx-http
8989
```
9090
-->
9191
```shell
92-
# 通过服务公开端口
92+
# 通过 Service 公开端口
9393
kubectl expose deployment nginx-app --port=80 --name=nginx-http
9494
```
9595
```
@@ -101,14 +101,14 @@ By using kubectl, you can create a [Deployment](/docs/concepts/workloads/control
101101
-->
102102
在 kubectl 命令中,我们创建了一个 [Deployment](/zh-cn/docs/concepts/workloads/controllers/deployment/)
103103
这将保证有 N 个运行 nginx 的 Pod(N 代表 spec 中声明的副本数,默认为 1)。
104-
我们还创建了一个 [service](/zh-cn/docs/concepts/services-networking/service/),其选择算符与容器标签匹配。
105-
查看[使用服务访问集群中的应用程序](/zh-cn/docs/tasks/access-application-cluster/service-access-application-cluster)获取更多信息。
104+
我们还创建了一个 [Service](/zh-cn/docs/concepts/services-networking/service/),其选择算符与容器标签匹配。
105+
查看[使用 Service 访问集群中的应用程序](/zh-cn/docs/tasks/access-application-cluster/service-access-application-cluster)获取更多信息。
106106

107107
<!--
108108
By default images run in the background, similar to `docker run -d ...`. To run things in the foreground, use [`kubectl run`](/docs/reference/generated/kubectl/kubectl-commands/#run) to create pod:
109109
-->
110110
默认情况下镜像会在后台运行,与 `docker run -d ...` 类似,如果你想在前台运行,
111-
使用 [`kubectl run`](/docs/reference/generated/kubectl/kubectl-commands/#run) 在前台运行 Pod:
111+
使用 [`kubectl run`](/docs/reference/generated/kubectl/kubectl-commands/#run) 在前台运行 Pod
112112

113113
```shell
114114
kubectl run [-i] [--tty] --attach <name> --image=<image>
@@ -139,7 +139,7 @@ To list what is currently running, see [kubectl get](/docs/reference/generated/k
139139
<!--
140140
docker:
141141
-->
142-
使用 Docker 命令:
142+
使用 docker 命令:
143143

144144
```shell
145145
docker ps -a
@@ -175,7 +175,7 @@ To attach a process that is already running in a container, see [kubectl attach]
175175
<!--
176176
docker:
177177
-->
178-
使用 Docker 命令:
178+
使用 docker 命令:
179179

180180
```shell
181181
docker ps
@@ -190,7 +190,10 @@ docker attach 55c103fa1296
190190
...
191191
```
192192

193+
<!--
193194
kubectl:
195+
-->
196+
使用 kubectl 命令:
194197

195198
```shell
196199
kubectl get pods
@@ -220,7 +223,7 @@ To execute a command in a container, see [kubectl exec](/docs/reference/generate
220223
<!--
221224
docker:
222225
-->
223-
使用 Docker 命令:
226+
使用 docker 命令:
224227

225228
```shell
226229
docker ps
@@ -264,14 +267,17 @@ To use interactive commands.
264267
<!--
265268
docker:
266269
-->
267-
使用 Docker 命令:
270+
使用 docker 命令:
268271

269272
```shell
270273
docker exec -ti 55c103fa1296 /bin/sh
271274
# exit
272275
```
273276

277+
<!--
274278
kubectl:
279+
-->
280+
使用 kubectl 命令:
275281

276282
```shell
277283
kubectl exec -ti nginx-app-5jyvm -- /bin/sh
@@ -293,7 +299,7 @@ To follow stdout/stderr of a process that is running, see [kubectl logs](/docs/r
293299
<!--
294300
docker:
295301
-->
296-
使用 Docker 命令:
302+
使用 docker 命令:
297303

298304
```shell
299305
docker logs -f a9e
@@ -320,7 +326,7 @@ kubectl logs -f nginx-app-zibvs
320326
There is a slight difference between pods and containers; by default pods do not terminate if their processes exit. Instead the pods restart the process. This is similar to the docker run option `--restart=always` with one major difference. In docker, the output for each invocation of the process is concatenated, but for Kubernetes, each invocation is separate. To see the output from a previous run in Kubernetes, do this:
321327
-->
322328
现在是时候提一下 Pod 和容器之间的细微差别了;默认情况下如果 Pod 中的进程退出 Pod 也不会终止,
323-
相反它将会重启该进程。这类似于 docker run 时的 `--restart=always` 选项,这是主要差别。
329+
相反它将会重启该进程。这类似于 `docker run` 时的 `--restart=always` 选项,这是主要差别。
324330
在 Docker 中,进程的每个调用的输出都是被连接起来的,但是对于 Kubernetes,每个调用都是分开的。
325331
要查看以前在 Kubernetes 中执行的输出,请执行以下操作:
326332

@@ -350,7 +356,7 @@ To stop and delete a running process, see [kubectl delete](/docs/reference/gener
350356
<!--
351357
docker:
352358
-->
353-
使用 Docker 命令:
359+
使用 docker 命令:
354360

355361
```shell
356362
docker ps
@@ -427,12 +433,12 @@ There is no direct analog of `docker login` in kubectl. If you are interested in
427433
<!--
428434
To get the version of client and server, see [kubectl version](/docs/reference/generated/kubectl/kubectl-commands/#version).
429435
-->
430-
如何查看客户端和服务端的版本?查看 [kubectl version](/docs/reference/generated/kubectl/kubectl-commands/#version)
436+
如何查看客户端和服务端的版本?查看 [kubectl version](/zh-cn/docs/reference/generated/kubectl/kubectl-commands/#version)
431437

432438
<!--
433439
docker:
434440
-->
435-
使用 Docker 命令:
441+
使用 docker 命令:
436442

437443
```shell
438444
docker version
@@ -473,7 +479,7 @@ To get miscellaneous information about the environment and configuration, see [k
473479
<!--
474480
docker:
475481
-->
476-
使用 Docker 命令:
482+
使用 docker 命令:
477483

478484
```shell
479485
docker info

content/zh-cn/docs/setup/best-practices/node-conformance.md

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@ verification and functionality test for a node. The test validates whether the
2222
node meets the minimum requirements for Kubernetes; a node that passes the test
2323
is qualified to join a Kubernetes cluster.
2424
-->
25-
**节点一致性测试** 是一个容器化的测试框架,提供了针对节点的系统验证和功能测试。
25+
**节点一致性测试**是一个容器化的测试框架,提供了针对节点的系统验证和功能测试。
2626
测试验证节点是否满足 Kubernetes 的最低要求;通过测试的节点有资格加入 Kubernetes 集群。
2727

2828
<!--
29-
The test validates whether the node meets the minimum requirements for Kubernetes; a node that passes the testis qualified to join a Kubernetes cluster.
29+
The test validates whether the node meets the minimum requirements for Kubernetes;
30+
a node that passes the testis qualified to join a Kubernetes cluster.
3031
-->
3132
该测试主要检测节点是否满足 Kubernetes 的最低要求,通过检测的节点有资格加入 Kubernetes 集群。
3233

@@ -40,14 +41,15 @@ To run node conformance test, a node must satisfy the same prerequisites as a
4041
standard Kubernetes node. At a minimum, the node should have the following
4142
daemons installed:
4243
-->
43-
要运行节点一致性测试,节点必须满足与标准 Kubernetes 节点相同的前提条件。节点至少应安装以下守护程序:
44+
要运行节点一致性测试,节点必须满足与标准 Kubernetes 节点相同的前提条件。
45+
节点至少应安装以下守护程序:
4446

4547
<!--
46-
* CRI-compatible container runtimes such as Docker, Containerd and CRI-O
47-
* Kubelet
48+
* CRI-compatible container runtimes such as Docker, Containerd and CRI-O
49+
* kubelet
4850
-->
4951
* 与 CRI 兼容的容器运行时,例如 Docker、Containerd 和 CRI-O
50-
* Kubelet
52+
* kubelet
5153

5254
<!--
5355
## Running Node Conformance Test
@@ -65,8 +67,8 @@ To run the node conformance test, perform the following steps:
6567
Because the test framework starts a local control plane to test the kubelet,
6668
use `http://localhost:8080` as the URL of the API server.
6769
There are some other kubelet command line parameters you may want to use:
68-
* `--cloud-provider`: If you are using `--cloud-provider=gce`, you should
69-
remove the flag to run the test.
70+
* `--cloud-provider`: If you are using `--cloud-provider=gce`, you should
71+
remove the flag to run the test.
7072
-->
7173
1. 得出 kubelet 的 `--kubeconfig` 的值;例如:`--kubeconfig=/var/lib/kubelet/config.yaml`
7274
由于测试框架启动了本地控制平面来测试 kubelet,因此使用 `http://localhost:8080`
@@ -75,20 +77,21 @@ To run the node conformance test, perform the following steps:
7577
* `--cloud-provider`:如果使用 `--cloud-provider=gce`,需要移除这个参数来运行测试。
7678

7779
<!--
78-
2. Run the node conformance test with command:
80+
1. Run the node conformance test with command:
7981
80-
```shell
81-
# $CONFIG_DIR is the pod manifest path of your Kubelet.
82-
# $LOG_DIR is the test output path.
83-
sudo docker run -it --rm --privileged --net=host \
84-
-v /:/rootfs -v $CONFIG_DIR:$CONFIG_DIR -v $LOG_DIR:/var/result \
85-
registry.k8s.io/node-test:0.2
82+
```shell
83+
# $CONFIG_DIR is the pod manifest path of your kubelet.
84+
# $LOG_DIR is the test output path.
85+
sudo docker run -it --rm --privileged --net=host \
86+
-v /:/rootfs -v $CONFIG_DIR:$CONFIG_DIR -v $LOG_DIR:/var/result \
87+
registry.k8s.io/node-test:0.2
88+
```
8689
```
8790
-->
8891
2. 使用以下命令运行节点一致性测试:
8992

9093
```shell
91-
# $CONFIG_DIR 是你 Kubeletpod manifest 路径。
94+
# $CONFIG_DIR 是你 kubeletPod manifest 路径。
9295
# $LOG_DIR 是测试的输出路径。
9396
sudo docker run -it --rm --privileged --net=host \
9497
-v /:/rootfs -v $CONFIG_DIR:$CONFIG_DIR -v $LOG_DIR:/var/result \
@@ -107,17 +110,17 @@ architectures:
107110
Kubernetes 也为其他硬件体系结构的系统提供了节点一致性测试的 Docker 镜像:
108111

109112
<!--
110-
Arch | Image |
111-
--------|:-----------------:|
112-
amd64 | node-test-amd64 |
113-
arm | node-test-arm |
114-
arm64 | node-test-arm64 |
113+
| Arch | Image |
114+
|--------|:-----------------:|
115+
| amd64 | node-test-amd64 |
116+
| arm | node-test-arm |
117+
| arm64 | node-test-arm64 |
115118
-->
116-
架构 | 镜像 |
117-
--------|:-----------------:|
118-
amd64 | node-test-amd64 |
119-
arm | node-test-arm |
120-
arm64 | node-test-arm64 |
119+
| 架构 | 镜像 |
120+
|--------|:-----------------:|
121+
| amd64 | node-test-amd64 |
122+
| arm | node-test-arm |
123+
| arm64 | node-test-arm64 |
121124

122125
<!--
123126
## Running Selected Test
@@ -158,22 +161,22 @@ sudo docker run -it --rm --privileged --net=host \
158161
registry.k8s.io/node-test:0.2
159162
```
160163

161-
162-
<!--
163-
Node conformance test is a containerized version of [node e2e test](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-node/e2e-node-tests.md).
164-
-->
165-
节点一致性测试是[节点端到端测试](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-node/e2e-node-tests.md)的容器化版本。
166164
<!--
165+
Node conformance test is a containerized version of
166+
[node e2e test](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-node/e2e-node-tests.md).
167167
By default, it runs all conformance tests.
168168
-->
169+
节点一致性测试是
170+
[节点端到端测试](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-node/e2e-node-tests.md)的容器化版本。
169171
默认情况下,它会运行所有一致性测试。
170172

171173
<!--
172174
Theoretically, you can run any node e2e test if you configure the container and
173175
mount required volumes properly. But **it is strongly recommended to only run conformance
174176
test**, because it requires much more complex configuration to run non-conformance test.
175177
-->
176-
理论上,只要合理地配置容器和挂载所需的卷,就可以运行任何的节点端到端测试用例。但是这里**强烈建议只运行一致性测试**,因为运行非一致性测试需要很多复杂的配置。
178+
理论上,只要合理地配置容器和挂载所需的卷,就可以运行任何的节点端到端测试用例。
179+
但是这里**强烈建议只运行一致性测试**,因为运行非一致性测试需要很多复杂的配置。
177180

178181
<!--
179182
## Caveats
@@ -187,6 +190,5 @@ test**, because it requires much more complex configuration to run non-conforman
187190
* The test leaves dead containers on the node. These containers are created
188191
during the functionality test.
189192
-->
190-
191193
* 测试会在节点上遗留一些 Docker 镜像,包括节点一致性测试本身的镜像和功能测试相关的镜像。
192194
* 测试会在节点上遗留一些死的容器。这些容器是在功能测试的过程中创建的。

0 commit comments

Comments
 (0)