@@ -33,7 +33,7 @@ The above list is sorted alphabetically by product name, not by recommendation o
33
33
To see how Kubernetes network policy works, start off by creating an ` nginx ` deployment.
34
34
35
35
``` console
36
- kubectl run nginx --image=nginx --replicas=2
36
+ kubectl create deployment nginx --image=nginx
37
37
```
38
38
``` none
39
39
deployment.apps/nginx created
@@ -62,7 +62,6 @@ service/nginx 10.100.0.16 <none> 80/TCP 33s
62
62
63
63
NAME READY STATUS RESTARTS AGE
64
64
pod/nginx-701339712-e0qfq 1/1 Running 0 35s
65
- pod/nginx-701339712-o00ef 1/1 Running 0 35s
66
65
```
67
66
68
67
## 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
72
71
Start a busybox container, and use ` wget ` on the ` nginx ` service:
73
72
74
73
``` 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
76
75
```
77
76
78
77
``` console
@@ -121,7 +120,7 @@ networkpolicy.networking.k8s.io/access-nginx created
121
120
If we attempt to access the nginx Service from a pod without the correct labels, the request will now time out:
122
121
123
122
``` 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
125
124
```
126
125
127
126
``` console
@@ -140,7 +139,7 @@ wget: download timed out
140
139
Create a pod with the correct labels, and you'll see that the request is allowed:
141
140
142
141
``` 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
144
143
```
145
144
146
145
``` console
0 commit comments