fix: use sh in md (#28)

pull/29/head
Rémy-Christophe Schermesser 5 years ago committed by GitHub
parent cfa5d4e104
commit 3c5b855dc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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
@ -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
@ -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]
@ -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]
@ -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
@ -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
```
@ -112,7 +112,7 @@ minikube dashboard
## Clean up
```bash
```sh
kubectl delete pod --all
```

@ -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
@ -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
@ -53,7 +53,7 @@ Nothing to see here.
## Clean up
```bash
```sh
kubectl delete pod --all
```

@ -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
```
@ -60,7 +60,7 @@ 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
@ -68,7 +68,7 @@ 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
@ -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
@ -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
```
@ -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
```
@ -152,7 +152,7 @@ Remember the command `kubectl describe deployment`.
## Clean up
```bash
```sh
kubectl delete deployment,rs,pod --all
```

@ -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
```
@ -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
```
@ -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
[...]
```
@ -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
@ -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
```
@ -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
```

@ -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
```
@ -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
```
@ -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
```

@ -17,7 +17,7 @@ data:
You can apply the file:
```bash
```sh
$ kubectl apply -f 10-secrets/01-secrets.yml
secret "mysecret" created
```
@ -78,7 +78,7 @@ Nothing to see here.
## Clean up
```bash
```sh
kubectl delete service,deployment,pod,secrets --all
```

@ -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
@ -134,7 +134,7 @@ Nothing to see here.
## Clean up
```bash
```sh
kubectl delete service,deployment,pod --all
```

@ -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
```

@ -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
```
@ -145,7 +145,7 @@ Nothing to see here.
## Clean up
```bash
```sh
kubectl delete service,deployment,pod --all
```

@ -33,7 +33,7 @@ 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
```
@ -41,7 +41,7 @@ Review and apply the manifests in [01-pdb.yml](./01-pdb.yml). Why did we specify
In a terminal run the command:
```bash
```sh
kubectl get pods -owide -w
```
@ -49,7 +49,7 @@ It will display all the pods with the node where it's deployed. The `-w` is to w
In another termimal run the command:
```bash
```sh
kubectl drain kind-worker2 --ignore-daemonsets
```
@ -63,7 +63,7 @@ Nothing to see here.
## Clean up
```bash
```sh
kubectl delete service,deployment,pod --all
```

@ -125,7 +125,7 @@ Nothing to see here.
## Clean up
```bash
```sh
kubectl delete service,deployment,pod,crd,vpa --all
```

@ -39,7 +39,7 @@ This exercice is taken from the [official Kubernetes documentation](https://kube
## Clean up
```bash
```sh
kubectl delete service,deployment,pod --all
```

@ -46,7 +46,7 @@ Let's review some parameters:
Apply it:
```bash
```sh
kubectl apply -f 10-volumes/01-simple-mysql-pv.yml
```
@ -67,7 +67,7 @@ spec:
The manifest is pretty similar to the `PersistentVolume`:
```bash
```sh
kubectl apply -f 10-volumes/02-simple-mysql-pvc.yml
```
@ -75,7 +75,7 @@ kubectl apply -f 10-volumes/02-simple-mysql-pvc.yml
Now let's create the `deployment` of mysql:
```bash
```sh
kubectl apply -f 10-volumes/03-simple-mysql-deployment.yml
```
@ -96,13 +96,13 @@ There is a bunch of parameters we haven't seen yet:
Let's finish by creating a `service` to have stable DNS entry inside our cluster.
```bash
```sh
kubectl apply -f 10-volumes/04-simple-mysql-service.yml
```
Finally let's access the mysql:
```bash
```sh
kubectl run -it --rm --image=mysql:5.6 --restart=Never mysql-client -- mysql -h mysql -ppassword
If you don't see a command prompt, try pressing enter.
@ -120,14 +120,14 @@ mysql> show databases;
Create a new database in mysql:
```bash
```sh
mysql> CREATE DATABASE testing;
Query OK, 1 row affected (0.01 sec)
```
Now delete the service and the deployment:
```bash
```sh
kubectl delete service,deployment --all
```
@ -139,6 +139,6 @@ Nothing to see here.
## Clean up
```bash
```sh
kubectl delete service,deployment,pvc,pv,pod --all
```

@ -13,7 +13,7 @@ They are intended for use in environments with many users spread across multiple
By default, all objects are in the `default` namespace. There is a "hidden" `namespace` where Kubernetes runs services for itself.
Try:
```bash
```sh
$ kubectl get namespace
NAME STATUS AGE
default Active 56d
@ -21,7 +21,7 @@ kube-public Active 56d
kube-system Active 56d
```
```bash
```sh
$ kubectl get all --namespace=kube-system
[lot of stuff]
@ -33,7 +33,7 @@ It is a tool to validate your Kubernetes YAML files: <https://github.com/garethr
The easiest integration is with `docker run`, if you files are in the directory `kubernetes`
```bash
```sh
docker run -it -v `pwd`/kubernetes:/kubernetes garethr/kubeval kubernetes/**/*
```
@ -95,6 +95,6 @@ spec:
## Clean up
```bash
```sh
kubectl delete statefulset,deployment,service,pod --all
```

@ -8,7 +8,7 @@ Nothing to see here.
## Clean up
```bash
```sh
kubectl delete service,deployment,pod --all
```

@ -8,7 +8,7 @@ Nothing to see here.
## Clean up
```bash
```sh
kubectl delete service,deployment,pod --all
```

@ -8,7 +8,7 @@ Nothing to see here.
## Clean up
```bash
```sh
kubectl delete service,deployment,pod --all
```

Loading…
Cancel
Save