From ed46d6b2d8b3c4118ecfe431aad6ae0b27318f9e Mon Sep 17 00:00:00 2001 From: Maximilian Bischoff Date: Mon, 23 Jul 2018 15:53:16 +0200 Subject: [PATCH] Missing language specs in fenced code blocks (#29) * Fixed fenced code-block containing manifest not being marked as yaml * Added missing sh indicator for shell block * Fixed missing delete statement * Added sh as language indicators to code blocks --- 01-deny-all-traffic-to-an-application.md | 4 ++-- 02-limit-traffic-to-an-application.md | 2 +- 02a-allow-all-traffic-to-an-application.md | 4 ++-- 04-deny-traffic-from-other-namespaces.md | 4 ++-- 05-allow-traffic-from-all-namespaces.md | 2 +- 06-allow-traffic-from-a-namespace.md | 2 +- 07-allow-traffic-from-some-pods-in-another-namespace.md | 2 +- 08-allow-external-traffic.md | 2 +- 11-deny-egress-traffic-from-an-application.md | 8 ++++---- 14-deny-external-egress-traffic.md | 8 ++++---- 10 files changed, 19 insertions(+), 19 deletions(-) diff --git a/01-deny-all-traffic-to-an-application.md b/01-deny-all-traffic-to-an-application.md index 899e17e..c5fcc49 100644 --- a/01-deny-all-traffic-to-an-application.md +++ b/01-deny-all-traffic-to-an-application.md @@ -43,7 +43,7 @@ spec: ingress: [] ``` -``` +```sh $ kubectl apply -f web-deny-all.yaml networkpolicy "web-deny-all" created ``` @@ -75,7 +75,7 @@ the traffic. ### Cleanup -``` +```sh kubectl delete deploy web kubectl delete service web kubectl delete networkpolicy web-deny-all diff --git a/02-limit-traffic-to-an-application.md b/02-limit-traffic-to-an-application.md index d50803d..20f0279 100644 --- a/02-limit-traffic-to-an-application.md +++ b/02-limit-traffic-to-an-application.md @@ -36,7 +36,7 @@ spec: app: bookstore ``` -``` +```sh $ kubectl apply -f api-allow.yaml networkpolicy "api-allow" created ``` diff --git a/02a-allow-all-traffic-to-an-application.md b/02a-allow-all-traffic-to-an-application.md index 42339e0..2e21b88 100644 --- a/02a-allow-all-traffic-to-an-application.md +++ b/02a-allow-all-traffic-to-an-application.md @@ -45,7 +45,7 @@ A few remarks about this manifest: Now apply it to the cluster: -``` +```sh $ kubectl apply -f web-allow-all.yaml networkpolicy "web-allow-all" created" ``` @@ -66,7 +66,7 @@ Traffic is allowed. ### Cleanup -``` +```sh kubectl delete deployment,service web kubectl delete networkpolicy web-allow-all web-deny-all ``` diff --git a/04-deny-traffic-from-other-namespaces.md b/04-deny-traffic-from-other-namespaces.md index 51c1763..2c47651 100644 --- a/04-deny-traffic-from-other-namespaces.md +++ b/04-deny-traffic-from-other-namespaces.md @@ -19,7 +19,7 @@ pod deployed to. Create a new namespace called `secondary` and start a web service: -``` +```sh kubectl create namespace secondary kubectl run web --namespace secondary --image=nginx \ @@ -43,7 +43,7 @@ spec: - podSelector: {} ``` -``` +```sh $ kubectl apply -f deny-from-other-namespaces.yaml networkpolicy "deny-from-other-namespaces" created" ``` diff --git a/05-allow-traffic-from-all-namespaces.md b/05-allow-traffic-from-all-namespaces.md index b87f309..3b07829 100644 --- a/05-allow-traffic-from-all-namespaces.md +++ b/05-allow-traffic-from-all-namespaces.md @@ -17,7 +17,7 @@ non-whitelisted traffic to all pods in the namespace](03-deny-all-non-whiteliste Create a new namespace called `secondary` and start a web service: -``` +```sh kubectl create namespace secondary kubectl run web --image=nginx \ diff --git a/06-allow-traffic-from-a-namespace.md b/06-allow-traffic-from-a-namespace.md index 3a6fc9e..69060b7 100644 --- a/06-allow-traffic-from-a-namespace.md +++ b/06-allow-traffic-from-a-namespace.md @@ -41,7 +41,7 @@ The following manifest restricts traffic to only pods in namespaces that has label `purpose=production`. Save it to `web-allow-prod.yaml` and apply to the cluster: -``` +```yaml kind: NetworkPolicy apiVersion: networking.k8s.io/v1 metadata: diff --git a/07-allow-traffic-from-some-pods-in-another-namespace.md b/07-allow-traffic-from-some-pods-in-another-namespace.md index 779d904..0e2a549 100644 --- a/07-allow-traffic-from-some-pods-in-another-namespace.md +++ b/07-allow-traffic-from-some-pods-in-another-namespace.md @@ -37,7 +37,7 @@ spec: type: monitoring ``` -``` +```sh $ kubectl apply -f web-allow-all-ns-monitoring.yaml networkpolicy.networking.k8s.io/web-allow-all-ns-monitoring created ``` diff --git a/08-allow-external-traffic.md b/08-allow-external-traffic.md index d5c680d..fb3941d 100644 --- a/08-allow-external-traffic.md +++ b/08-allow-external-traffic.md @@ -14,7 +14,7 @@ or via a Load Balancer to access to the pod. Run a web server and expose it to the internet with a Load Balancer: -``` +```sh kubectl run web --image=nginx \ --labels=app=web --port 80 diff --git a/11-deny-egress-traffic-from-an-application.md b/11-deny-egress-traffic-from-an-application.md index 2e40af6..3caf6f4 100644 --- a/11-deny-egress-traffic-from-an-application.md +++ b/11-deny-egress-traffic-from-an-application.md @@ -42,7 +42,7 @@ Remarks about this manifest file: egress (outbound) traffic is blocked. - You can drop this field altogether and have the same effect. -``` +```sh kubectl apply -f foo-deny-egress.yaml networkpolicy "foo-deny-egress" created ``` @@ -51,7 +51,7 @@ networkpolicy "foo-deny-egress" created Run a pod with label `app=foo`, and try to connect to the `web` service: -``` +```sh $ kubectl run --rm --restart=Never --image=alpine -i -t -l app=foo test -- ash / # wget -qO- --timeout 1 http://web:80/ @@ -70,7 +70,7 @@ allowing it to establish connections to the `kube-dns` Pods. So we slightly modify the YAML file to allow all outbound traffic on DNS ports (`53/udp` and `53/tcp`): -``` +```sh apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: @@ -93,7 +93,7 @@ spec: Now when we try again, we actually see the IP addresses are resolved, but the traffic is blocked: -``` +```sh / # wget --timeout 1 -O- http://web Connecting to web (10.59.245.232:80) wget: download timed out diff --git a/14-deny-external-egress-traffic.md b/14-deny-external-egress-traffic.md index d7d333d..07a7c33 100644 --- a/14-deny-external-egress-traffic.md +++ b/14-deny-external-egress-traffic.md @@ -50,7 +50,7 @@ Few remarks about this policy: Now apply it to the cluster: -``` +```sh kubectl apply -f foo-deny-egress.yaml networkpolicy "foo-deny-egress" created ``` @@ -64,7 +64,7 @@ Run a web application named `web`: Run a pod with label `app=foo`. The policy will be enforced on this pod: -``` +```sh $ kubectl run --rm --restart=Never --image=alpine -i -t -l app=foo test -- ash / # wget -O- --timeout 1 http://web:80 @@ -79,7 +79,7 @@ The pod with `app=foo` label is able to connect to `web` Service. Now try with an external address: -``` +```sh / # wget -O- --timeout 1 http://www.example.com Connecting to www.example.com (93.184.216.34:80) wget: download timed out @@ -93,7 +93,7 @@ cannot establish a connection. Effectively, external traffic is blocked. ## Cleanup -``` +```sh kubectl delete deployment,service web kubectl delete networkpolicy foo-deny-external-egress ```