Skip to content

Commit 251a065

Browse files
authored
Merge pull request #21537 from Cweiping/remove_kubectl_run_command_deprecated_zh
deprecated kubectl run command flag replicas for zh
2 parents c97d0a0 + 92ded2a commit 251a065

File tree

4 files changed

+19
-13
lines changed

4 files changed

+19
-13
lines changed

content/zh/docs/concepts/cluster-administration/manage-deployment.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ Let's say you were running version 1.7.9 of nginx:
631631
假设您正运行的是 1.7.9 版本的 nginx:
632632

633633
```shell
634-
kubectl run my-nginx --image=nginx:1.7.9 --replicas=3
634+
kubectl create deployment my-nginx --image=nginx:1.7.9
635635
```
636636
```shell
637637
deployment.apps/my-nginx created

content/zh/docs/concepts/policy/resource-quotas.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ kubectl create quota test --hard=count/deployments.extensions=2,count/replicaset
729729
```
730730

731731
```shell
732-
kubectl run nginx --image=nginx --replicas=2 --namespace=myspace
732+
kubectl create deployment nginx --image=nginx --namespace=myspace
733733
```
734734

735735
```shell

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
<!-- 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 run --image=nginx nginx-app --port=80 --env="DOMAIN=cluster"
59+
kubectl create deployment --image=nginx nginx-app
6160
```
6261
```
63-
deployment "nginx-app" created
62+
deployment.apps/nginx-app created
63+
```
64+
65+
```
66+
# add env to nginx-app
67+
kubectl set env deployment/nginx-app DOMAIN=cluster
68+
```
69+
```
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>

content/zh/docs/tasks/administer-cluster/declare-network-policy.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ content_type: task
3737
为了查看 Kubernetes 网络策略是怎样工作的,可以从创建一个`nginx` deployment 并且通过服务将其暴露开始
3838

3939
```console
40-
$ kubectl run nginx --image=nginx --replicas=2
40+
$ kubectl create deployment nginx --image=nginx
4141
deployment "nginx" created
4242
$ kubectl expose deployment nginx --port=80
4343
service "nginx" exposed
@@ -54,7 +54,6 @@ svc/nginx 10.100.0.16 <none> 80/TCP 33s
5454

5555
NAME READY STATUS RESTARTS AGE
5656
po/nginx-701339712-e0qfq 1/1 Running 0 35s
57-
po/nginx-701339712-o00ef 1/1 Running 0 35s
5857
```
5958

6059

0 commit comments

Comments
 (0)