Skip to content

Commit 92ded2a

Browse files
author
Weiping Cai
committed
update kubectl document for zh
Signed-off-by: Weiping Cai <[email protected]>
1 parent cca324e commit 92ded2a

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

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

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,10 @@ You can use the Kubernetes command line tool kubectl to interact with the API Se
2525
{{% capture body %}}
2626
## docker run
2727

28-
<!--
29-
To run an nginx Deployment and expose the Deployment, see [kubectl run](/docs/reference/generated/kubectl/kubectl-commands/#run).
28+
<!--
29+
To run an nginx Deployment and expose the Deployment, see [kubectl create deployment](/docs/reference/generated/kubectl/kubectl-commands#-em-deployment-em-).
3030
-->
31-
要运行 nginx 部署并将其暴露,请参见 [kubectl 运行](/docs/reference/generated/kubectl/kubectl-commands/#run)
32-
31+
要运行 nginx 部署并将其暴露,请参见[kubectl create deployment](/docs/reference/generated/kubectl/kubectl-commands#-em-deployment-em-)
3332
docker:
3433

3534
```shell
@@ -57,10 +56,18 @@ kubectl run --image=nginx nginx-app --port=80 --env="DOMAIN=cluster"
5756
-->
5857
```shell
5958
# 启动运行 nginx 的 Pod
60-
kubectl create deployment --image=nginx nginx-app --port=80 --env="DOMAIN=cluster"
59+
kubectl create deployment --image=nginx nginx-app
60+
```
61+
```
62+
deployment.apps/nginx-app created
63+
```
64+
65+
```
66+
# add env to nginx-app
67+
kubectl set env deployment/nginx-app DOMAIN=cluster
6168
```
6269
```
63-
deployment "nginx-app" created
70+
deployment.apps/nginx-app env updated
6471
```
6572

6673
{{< note >}}
@@ -89,10 +96,10 @@ By using kubectl, you can create a [Deployment](/docs/concepts/workloads/control
8996
-->
9097
在 kubectl 命令中,我们创建了一个 [Deployment](/docs/concepts/workloads/controllers/deployment/),这将保证有 N 个运行 nginx 的 pod(N 代表 spec 中声明的 replica 数,默认为 1)。我们还创建了一个 [service](/docs/concepts/services-networking/service/),其选择器与容器标签匹配。查看[使用服务访问群集中的应用程序](/docs/tasks/access-application-cluster/service-access-application-cluster) 获取更多信息。
9198

92-
<!--
93-
By default images run in the background, similar to `docker run -d ...`. To run things in the foreground, use:
99+
<!--
100+
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:
94101
-->
95-
默认情况下镜像会在后台运行,与 `docker run -d ...` 类似,如果您想在前台运行,使用:
102+
默认情况下镜像会在后台运行,与 `docker run -d ...` 类似,如果您想在前台运行,使用 [`kubectl run`](/docs/reference/generated/kubectl/kubectl-commands/#run) 在前台运行 Pod:
96103

97104
```shell
98105
kubectl run [-i] [--tty] --attach <name> --image=<image>

0 commit comments

Comments
 (0)