Skip to content

Commit

Permalink
fix: use sh in md (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
ElPicador committed May 21, 2019
1 parent cfa5d4e commit 3c5b855
Show file tree
Hide file tree
Showing 17 changed files with 61 additions and 61 deletions.
14 changes: 7 additions & 7 deletions 05-pods/README.md
Expand Up @@ -43,7 +43,7 @@ Let's have a look a the fields:

Let's `apply` this manifest to Kubernetes. This will tell Kubernetes to create the `pod` and run it.

```bash
```sh
$ kubectl apply -f 05-pods/01-simple-pod.yml

pod "simple-pod" created
Expand All @@ -55,7 +55,7 @@ We also could have used the `kubectl create -f ...`. But it's better to have a d

Now list all the `pods` running in Kubernetes. `get` is the `ls` of Kubernetes.

```bash
```sh
$ kubectl get pod

NAME READY STATUS RESTARTS AGE
Expand All @@ -66,7 +66,7 @@ simple-pod 1/1 Running 0 4s

Let's have a look at the logs of this `pod`:

```bash
```sh
$ kubectl logs simple-pod

2018-10-01T09:21:59 INFO This is simple service in version v0.5.0 listening on port 9876 [at line 142]
Expand All @@ -78,7 +78,7 @@ $ kubectl logs simple-pod

Our first `pod` is now running. Now `describe` it. `describe` is a `get` on steroid, with more information.

```bash
```sh
$ kubectl describe pod simple-pod

[a lot of stuff]
Expand All @@ -92,7 +92,7 @@ Look at the information provided. Get the field `IP`, it's the internal ip for t

Connect to the cluster, and try to `curl` this ip - `172.17.0.4` in the example.

```bash
```sh
$ minikube ssh
$ curl 172.17.0.4:9876/info

Expand All @@ -101,7 +101,7 @@ $ curl 172.17.0.4:9876/info

Kubernetes has a useful add-on, a web dashboard. It's included by default in minikube. You can start it with:

```bash
```sh
minikube dashboard
```

Expand All @@ -112,7 +112,7 @@ minikube dashboard

## Clean up

```bash
```sh
kubectl delete pod --all
```

Expand Down
6 changes: 3 additions & 3 deletions 06-label-annotation/README.md
Expand Up @@ -28,7 +28,7 @@ Apply the pod `06-label-annotation/02-nginx.yml`. It is a simple nginx with 2 la

Let's list all the pods that are in the `env=production`:

```bash
```sh
$ kubectl get pods -l env=production

NAME READY STATUS RESTARTS AGE
Expand All @@ -38,7 +38,7 @@ simple-pod 1/1 Running 0 13s

Let's list all the pods that are in the `env=production,tier=frontend`:

```bash
```sh
$ kubectl get pods -l env=production,tier=frontend

NAME READY STATUS RESTARTS AGE
Expand All @@ -53,7 +53,7 @@ Nothing to see here.

## Clean up

```bash
```sh
kubectl delete pod --all
```

Expand Down
18 changes: 9 additions & 9 deletions 07-deployment/README.md
Expand Up @@ -51,7 +51,7 @@ Let's have a look at the manifest:

Apply the deployment:

```bash
```sh
$ kubectl apply -f 07-deployment/01-simple-deployment.yml
deployment.apps/simple-deployment created
```
Expand All @@ -60,15 +60,15 @@ deployment.apps/simple-deployment created

Let's have a look at what this `deployment` created for us:

```bash
```sh
$ kubectl get deployment
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
simple-deployment 2 2 2 2 2m
```

Firstly, Kubernetes created a `deployment`. We see a lot of 2s. It is the number of replicas that are available. Let's have a look at the pods we have running:

```bash
```sh
$ kubectl get pod

NAME READY STATUS RESTARTS AGE
Expand All @@ -80,7 +80,7 @@ The `deployment` created 2 pods for us, the number we put in `replicas`. We see

Did Kubernetes created something else for us? Let's have a look

```bash
```sh
$ kubectl get all

NAME READY STATUS RESTARTS AGE
Expand Down Expand Up @@ -108,19 +108,19 @@ We won't go into details of what a [`ReplicaSet`](https://kubernetes.io/docs/con
Let's play with our `deployment` now.
Update the number of `replicas` in the yaml, to a reasonable number - say `5`.

```bash
```sh
kubectl apply -f 07-deployment/01-simple-deployment.yml
```

You can also use `kubectl scale`:

```bash
```sh
kubectl scale --replicas=5 -f 07-deployment/01-simple-deployment.yml
```

You can also edit the manifest in place with `kubectl edit`:

```bash
```sh
kubectl edit deployment simple-deployment
```

Expand All @@ -136,7 +136,7 @@ Change again the number of replicas to `2`, reapply, see what is happening.

We know how to scale up/down a deployment, but how can we deploy a new version of the application. To achieve this, we need to tell Kubernetes to update the image we are using in our `deployment`, for this:

```bash
```sh
$ kubectl set image deployment/simple-deployment simple-service=mhausenblas/simpleservice:0.5.0
deployment.apps "simple-deployment" image updated
```
Expand All @@ -152,7 +152,7 @@ Remember the command `kubectl describe deployment`.

## Clean up

```bash
```sh
kubectl delete deployment,rs,pod --all
```

Expand Down
20 changes: 10 additions & 10 deletions 08-service/README.md
Expand Up @@ -8,7 +8,7 @@ In this section you will learn how to access your application from outside your

If it's not already done install the `minikube` addon `ingress`:

```bash
```sh
$ minikube addons enable ingress
✅ ingress was successfully enabled
```
Expand All @@ -21,7 +21,7 @@ What we need is a `service`. It'll allow us to access our pods internally or ext

First apply the `deployment`:

```bash
```sh
$ kubectl apply -f 08-service/01-simple-deployment.yml
deployment.apps "simple-deployment" created
```
Expand All @@ -30,21 +30,21 @@ Now start another container. We will use it to see what we can access internally

Apply the pod:

```bash
```sh
$ kubectl apply -f 08-service/02-bash.yml
pod "bash" created
```

And connect to it:

```bash
```sh
$ kubectl exec -it bash -- /bin/bash
root@bash:/#
```

Install `dnsutils` & `curl` in the container, you will need them:

```bash
```sh
root@bash:/# apt update && apt install dnsutils curl
[...]
```
Expand Down Expand Up @@ -85,14 +85,14 @@ is central to Kubernetes. It is with those fields that you will tell Kubernetes

Apply the service:

```bash
```sh
$ kubectl apply -f 08-service/03-simple-service.yml
service "simple-service" created
```

Your service is now accessible internally, try this in your `bash` container:

```bash
```sh
root@bash:/# nslookup simple-service
Server: 10.96.0.10
Address: 10.96.0.10#53
Expand Down Expand Up @@ -147,14 +147,14 @@ Let's have a look at the manifest:

Apply the ingress:

```bash
```sh
$ kubectl apply -f 08-service/04-ingress.yml
ingress.extensions "simple-ingress" created
```

Get the IP of your minikube cluster:

```bash
```sh
$ minikube ip
192.168.99.100
```
Expand Down Expand Up @@ -204,7 +204,7 @@ You have seen a lot different `kind` of Kubernetes, let's take a step back and s

## Clean up

```bash
```sh
kubectl delete ingress,service,deployment,rs,pod --all
```

Expand Down
6 changes: 3 additions & 3 deletions 09-cronjob/README.md
Expand Up @@ -33,7 +33,7 @@ spec:

Let's apply it:

```bash
```sh
$ kubectl apply -f 09-cronjob/01-simple-cronjob.yml
cronjob.batch "simple-cronjob" created
```
Expand Down Expand Up @@ -63,7 +63,7 @@ This manifest is fairly close to a `CronJob`.

Apply it and see what is happening. Does it restarts?

```bash
```sh
$ kubectl apply -f 09-cronjob/02-simple-job.yml
job.batch "simple-job" created
```
Expand All @@ -77,7 +77,7 @@ If you have a long running background process - like a consumer of a queue - you

## Clean up

```bash
```sh
kubectl delete deployment,rs,service,cronjob,pod --all
```

Expand Down
4 changes: 2 additions & 2 deletions 10-secrets/README.md
Expand Up @@ -17,7 +17,7 @@ data:

You can apply the file:

```bash
```sh
$ kubectl apply -f 10-secrets/01-secrets.yml
secret "mysecret" created
```
Expand Down Expand Up @@ -78,7 +78,7 @@ Nothing to see here.

## Clean up

```bash
```sh
kubectl delete service,deployment,pod,secrets --all
```

Expand Down
4 changes: 2 additions & 2 deletions 11-probes/README.md
Expand Up @@ -111,7 +111,7 @@ Run `kubectl get deployments -w` and see what is happening.

The pods are "Running" but not ready (the READY column to 0/1).

```bash
```sh
kubectl get pods
NAME READY STATUS RESTARTS AGE
readiness-deployment-5dd7f6ff87-jsm9f 0/1 Running 0 2m17s
Expand All @@ -134,7 +134,7 @@ Nothing to see here.

## Clean up

```bash
```sh
kubectl delete service,deployment,pod --all
```

Expand Down
2 changes: 1 addition & 1 deletion 12-resources/README.md
Expand Up @@ -123,7 +123,7 @@ Review and apply the file [04-ram-limits.yml](./04-ram-limits.yml). Look at the

## Clean up

```bash
```sh
kubectl delete service,deployment,pod --all
```

Expand Down
6 changes: 3 additions & 3 deletions 13-affinity-anti-affinity/README.md
Expand Up @@ -101,13 +101,13 @@ Node affinity is very close to pod affinity. Instead of specifying a `podAffinit

Each resource in Kubernetes can have labels, even nodes. You can see them with `kubectl`:

```bash
```sh
kubectl get nodes --show-labels
```

You can add labels to a node with:

```bash
```sh
kubectl label nodes [nodeName] gpu=yes
```

Expand Down Expand Up @@ -145,7 +145,7 @@ Nothing to see here.

## Clean up

```bash
```sh
kubectl delete service,deployment,pod --all
```

Expand Down
8 changes: 4 additions & 4 deletions 14-pdb/README.md
Expand Up @@ -33,23 +33,23 @@ If you want to see the effect of a PDB, you will need a multi-node Kubernetes. A

Use the [configuration file](./kind.yml) provided to create your cluster:

```bash
```sh
kind create cluster --config kind.yml
```

Review and apply the manifests in [01-pdb.yml](./01-pdb.yml). Why did we specify a soft anti-affinity?

In a terminal run the command:

```bash
```sh
kubectl get pods -owide -w
```

It will display all the pods with the node where it's deployed. The `-w` is to watch the changes of those resources.

In another termimal run the command:

```bash
```sh
kubectl drain kind-worker2 --ignore-daemonsets
```

Expand All @@ -63,7 +63,7 @@ Nothing to see here.

## Clean up

```bash
```sh
kubectl delete service,deployment,pod --all
```

Expand Down
2 changes: 1 addition & 1 deletion 15-hpa-vpa/README.md
Expand Up @@ -125,7 +125,7 @@ Nothing to see here.

## Clean up

```bash
```sh
kubectl delete service,deployment,pod,crd,vpa --all
```

Expand Down

0 comments on commit 3c5b855

Please sign in to comment.