update kubectl document for zh
Signed-off-by: Weiping Cai <weiping.cai@daocloud.io>
This commit is contained in:
@@ -26,10 +26,9 @@ You can use the Kubernetes command line tool kubectl to interact with the API Se
|
|||||||
## docker run
|
## docker run
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
To run an nginx Deployment and expose the Deployment, see [kubectl run](/docs/reference/generated/kubectl/kubectl-commands/#run).
|
To run an nginx Deployment and expose the Deployment, see [kubectl create deployment](/docs/reference/generated/kubectl/kubectl-commands#-em-deployment-em-).
|
||||||
-->
|
-->
|
||||||
要运行 nginx 部署并将其暴露,请参见 [kubectl 运行](/docs/reference/generated/kubectl/kubectl-commands/#run)。
|
要运行 nginx 部署并将其暴露,请参见[kubectl create deployment](/docs/reference/generated/kubectl/kubectl-commands#-em-deployment-em-)
|
||||||
|
|
||||||
docker:
|
docker:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
@@ -57,10 +56,18 @@ kubectl run --image=nginx nginx-app --port=80 --env="DOMAIN=cluster"
|
|||||||
-->
|
-->
|
||||||
```shell
|
```shell
|
||||||
# 启动运行 nginx 的 Pod
|
# 启动运行 nginx 的 Pod
|
||||||
kubectl create deployment --image=nginx nginx-app --port=80 --env="DOMAIN=cluster"
|
kubectl create deployment --image=nginx nginx-app
|
||||||
```
|
```
|
||||||
```
|
```
|
||||||
deployment "nginx-app" created
|
deployment.apps/nginx-app created
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
# add env to nginx-app
|
||||||
|
kubectl set env deployment/nginx-app DOMAIN=cluster
|
||||||
|
```
|
||||||
|
```
|
||||||
|
deployment.apps/nginx-app env updated
|
||||||
```
|
```
|
||||||
|
|
||||||
{{< note >}}
|
{{< note >}}
|
||||||
@@ -90,9 +97,9 @@ By using kubectl, you can create a [Deployment](/docs/concepts/workloads/control
|
|||||||
在 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) 获取更多信息。
|
在 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) 获取更多信息。
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
By default images run in the background, similar to `docker run -d ...`. To run things in the foreground, use:
|
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:
|
||||||
-->
|
-->
|
||||||
默认情况下镜像会在后台运行,与 `docker run -d ...` 类似,如果您想在前台运行,使用:
|
默认情况下镜像会在后台运行,与 `docker run -d ...` 类似,如果您想在前台运行,使用 [`kubectl run`](/docs/reference/generated/kubectl/kubectl-commands/#run) 在前台运行 Pod:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
kubectl run [-i] [--tty] --attach <name> --image=<image>
|
kubectl run [-i] [--tty] --attach <name> --image=<image>
|
||||||
|
|||||||
Reference in New Issue
Block a user