Skip to content

Commit c1dcada

Browse files
authored
Merge pull request #21536 from Cweiping/remove_kubectl_run_command_deprecated_en
deprecated kubectl run command for en
2 parents 81a7d63 + 81027d6 commit c1dcada

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ You can use the Kubernetes command line tool kubectl to interact with the API Se
1313
<!-- body -->
1414
## docker run
1515

16-
To run an nginx Deployment and expose the Deployment, see [kubectl run](/docs/reference/generated/kubectl/kubectl-commands/#run).
16+
To run an nginx Deployment and expose the Deployment, see [kubectl create deployment](/docs/reference/generated/kubectl/kubectl-commands#-em-deployment-em-).
1717

1818
docker:
1919

@@ -36,10 +36,18 @@ kubectl:
3636

3737
```shell
3838
# start the pod running nginx
39-
kubectl run --image=nginx nginx-app --port=80 --env="DOMAIN=cluster"
39+
kubectl create deployment --image=nginx nginx-app
4040
```
4141
```
42-
deployment "nginx-app" created
42+
deployment.apps/nginx-app created
43+
```
44+
45+
```
46+
# add env to nginx-app
47+
kubectl set env deployment/nginx-app DOMAIN=cluster
48+
```
49+
```
50+
deployment.apps/nginx-app env updated
4351
```
4452

4553
{{< note >}}
@@ -56,7 +64,7 @@ service "nginx-http" exposed
5664

5765
By using kubectl, you can create a [Deployment](/docs/concepts/workloads/controllers/deployment/) to ensure that N pods are running nginx, where N is the number of replicas stated in the spec and defaults to 1. You can also create a [service](/docs/concepts/services-networking/service/) with a selector that matches the pod labels. For more information, see [Use a Service to Access an Application in a Cluster](/docs/tasks/access-application-cluster/service-access-application-cluster).
5866

59-
By default images run in the background, similar to `docker run -d ...`. To run things in the foreground, use:
67+
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:
6068

6169
```shell
6270
kubectl run [-i] [--tty] --attach <name> --image=<image>

0 commit comments

Comments
 (0)