From 0d4d62397ea0785830123270d909b0aed62cc9cb Mon Sep 17 00:00:00 2001 From: Jesse Meng Date: Sat, 25 Dec 2021 14:20:01 +0800 Subject: [PATCH] add networkpolicy examples --- module14/networkpolicy/readme.MD | 12 +++++++++++- module14/networkpolicy/toolbox.yaml | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/module14/networkpolicy/readme.MD b/module14/networkpolicy/readme.MD index 8a54e0d..996206e 100644 --- a/module14/networkpolicy/readme.MD +++ b/module14/networkpolicy/readme.MD @@ -13,6 +13,7 @@ kubectl get po -n calico-demo -owide ### start clientpod ``` kubectl apply -f toolbox.yaml +kubectl apply -f toolbox.yaml -n calico-demo ``` ### enter toolbox shell ``` @@ -27,7 +28,16 @@ ping ``` kubectl create -f allow-icmp-incluster.yaml ``` -### test connectivity +### test connectivity from two toolbox pod +``` +curl +ping +``` +### create networkpolicy to allow access +``` +kubectl create -f access-calico-demo.yaml +``` +### test connectivity from two toolbox pod ``` curl ping diff --git a/module14/networkpolicy/toolbox.yaml b/module14/networkpolicy/toolbox.yaml index 034b852..8feff40 100644 --- a/module14/networkpolicy/toolbox.yaml +++ b/module14/networkpolicy/toolbox.yaml @@ -1,7 +1,7 @@ apiVersion: apps/v1 kind: Deployment metadata: - namespace: default +# namespace: default name: toolbox spec: replicas: 1