From 7e1649a5afd930fbc42d46a85d874f11fcc1f66e Mon Sep 17 00:00:00 2001 From: Mazedur Rahman Date: Tue, 7 Apr 2020 09:42:29 -0700 Subject: [PATCH] Use run-pod/v1 in kubectl run command for 04-deny-traffic-from-other-namespaces.md (#53) * Replace deprecated API based deployment with new * Update cleanup to use pod instead of deployment --- 04-deny-traffic-from-other-namespaces.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/04-deny-traffic-from-other-namespaces.md b/04-deny-traffic-from-other-namespaces.md index 2c47651..cf05f70 100644 --- a/04-deny-traffic-from-other-namespaces.md +++ b/04-deny-traffic-from-other-namespaces.md @@ -22,7 +22,7 @@ Create a new namespace called `secondary` and start a web service: ```sh kubectl create namespace secondary -kubectl run web --namespace secondary --image=nginx \ +kubectl run --generator=run-pod/v1 web --namespace secondary --image=nginx \ --labels=app=web --expose --port 80 ``` @@ -61,7 +61,7 @@ Note a few things about this manifest: Query this web service from the `default` namespace: ```sh -$ kubectl run test-$RANDOM --namespace=default --rm -i -t --image=alpine -- sh +$ kubectl run --generator=run-pod/v1 test-$RANDOM --namespace=default --rm -i -t --image=alpine -- sh / # wget -qO- --timeout=2 http://web.secondary wget: download timed out ``` @@ -71,7 +71,7 @@ It blocks the traffic from `default` namespace! Any pod in `secondary` namespace should work fine: ```sh -$ kubectl run test-$RANDOM --namespace=secondary --rm -i -t --image=alpine -- sh +$ kubectl run --generator=run-pod/v1 test-$RANDOM --namespace=secondary --rm -i -t --image=alpine -- sh / # wget -qO- --timeout=2 http://web.secondary @@ -79,7 +79,7 @@ $ kubectl run test-$RANDOM --namespace=secondary --rm -i -t --image=alpine -- sh ### Cleanup - kubectl delete deployment web -n secondary + kubectl delete pod web -n secondary kubectl delete service web -n secondary kubectl delete networkpolicy deny-from-other-namespaces -n secondary kubectl delete namespace secondary