Skip to content

Commit 07c58dc

Browse files
committed
replace depercated commands with new commands
1 parent db64ecd commit 07c58dc

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

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

+4-5
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ The above list is sorted alphabetically by product name, not by recommendation o
3333
To see how Kubernetes network policy works, start off by creating an `nginx` deployment.
3434

3535
```console
36-
kubectl run nginx --image=nginx --replicas=2
36+
kubectl create deployment nginx --image=nginx
3737
```
3838
```none
3939
deployment.apps/nginx created
@@ -62,7 +62,6 @@ service/nginx 10.100.0.16 <none> 80/TCP 33s
6262
6363
NAME READY STATUS RESTARTS AGE
6464
pod/nginx-701339712-e0qfq 1/1 Running 0 35s
65-
pod/nginx-701339712-o00ef 1/1 Running 0 35s
6665
```
6766

6867
## Test the service by accessing it from another pod
@@ -72,7 +71,7 @@ You should be able to access the new `nginx` service from other pods. To test, a
7271
Start a busybox container, and use `wget` on the `nginx` service:
7372

7473
```console
75-
kubectl run busybox --rm -ti --image=busybox /bin/sh
74+
kubectl run --generator=run-pod/v1 busybox --rm -ti --image=busybox -- /bin/sh
7675
```
7776

7877
```console
@@ -121,7 +120,7 @@ networkpolicy.networking.k8s.io/access-nginx created
121120
If we attempt to access the nginx Service from a pod without the correct labels, the request will now time out:
122121

123122
```console
124-
kubectl run busybox --rm -ti --image=busybox /bin/sh
123+
kubectl run --generator=run-pod/v1 busybox --rm -ti --image=busybox -- /bin/sh
125124
```
126125

127126
```console
@@ -140,7 +139,7 @@ wget: download timed out
140139
Create a pod with the correct labels, and you'll see that the request is allowed:
141140

142141
```console
143-
kubectl run busybox --rm -ti --labels="access=true" --image=busybox /bin/sh
142+
kubectl run --generator=run-pod/v1 busybox --rm -ti --labels="access=true" --image=busybox -- /bin/sh
144143
```
145144

146145
```console

0 commit comments

Comments
 (0)