Skip to content

Commit

Permalink
Missing language specs in fenced code blocks (#29)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
maxbischoff authored and ahmetb committed Jul 23, 2018
1 parent 6d57370 commit ed46d6b
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions 01-deny-all-traffic-to-an-application.md
Expand Up @@ -43,7 +43,7 @@ spec:
ingress: []
```

```
```sh
$ kubectl apply -f web-deny-all.yaml
networkpolicy "web-deny-all" created
```
Expand Down Expand Up @@ -75,7 +75,7 @@ the traffic.

### Cleanup

```
```sh
kubectl delete deploy web
kubectl delete service web
kubectl delete networkpolicy web-deny-all
Expand Down
2 changes: 1 addition & 1 deletion 02-limit-traffic-to-an-application.md
Expand Up @@ -36,7 +36,7 @@ spec:
app: bookstore
```

```
```sh
$ kubectl apply -f api-allow.yaml
networkpolicy "api-allow" created
```
Expand Down
4 changes: 2 additions & 2 deletions 02a-allow-all-traffic-to-an-application.md
Expand Up @@ -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"
```
Expand All @@ -66,7 +66,7 @@ Traffic is allowed.
### Cleanup
```
```sh
kubectl delete deployment,service web
kubectl delete networkpolicy web-allow-all web-deny-all
```
4 changes: 2 additions & 2 deletions 04-deny-traffic-from-other-namespaces.md
Expand Up @@ -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 \
Expand All @@ -43,7 +43,7 @@ spec:
- podSelector: {}
```

```
```sh
$ kubectl apply -f deny-from-other-namespaces.yaml
networkpolicy "deny-from-other-namespaces" created"
```
Expand Down
2 changes: 1 addition & 1 deletion 05-allow-traffic-from-all-namespaces.md
Expand Up @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion 06-allow-traffic-from-a-namespace.md
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion 07-allow-traffic-from-some-pods-in-another-namespace.md
Expand Up @@ -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
```
Expand Down
2 changes: 1 addition & 1 deletion 08-allow-external-traffic.md
Expand Up @@ -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

Expand Down
8 changes: 4 additions & 4 deletions 11-deny-egress-traffic-from-an-application.md
Expand Up @@ -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
```
Expand All @@ -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/
Expand All @@ -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:
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions 14-deny-external-egress-traffic.md
Expand Up @@ -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
```
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
```

0 comments on commit ed46d6b

Please sign in to comment.