Fix stuff

This commit is contained in:
Rémy-Christophe Schermesser 2018-10-02 10:04:09 +02:00
parent 55a454b3b7
commit 3c3865fa9e
3 changed files with 22 additions and 2 deletions

View File

@ -2,7 +2,9 @@
In this section we will learn what is a pod, deploy your first container, configure k8s, and interact with k8s in the command line.
The base job of kubernetes is to schedule pods. Kubernetes will choose how where to schedule them. But it has a base assumption that a pod can be killed/restarted when whenever it wants to. So keep in mind that a pod is **mortal**.
The base job of k8s is to schedule pods. K8s will choose how and where to schedule them. You can also see a pod as an object that requests some CPU & RAM, and k8s will take those requirements into account in his scheduling.
But it has a base assumption that a pod can be killed whenever it wants to. So keep in mind that a pod is **mortal** and it **will** be destroyed at some point.
Let's start to deploy this docker image https://hub.docker.com/r/mhausenblas/simpleservice/.
It's a stateless python JSON API that answers on:

View File

@ -96,6 +96,16 @@ Update the number of `replicas` in the yaml, to a reasonnable number - say `5`.
$ kubectl apply -f 06-deployment/01-simple-deployment.yml
```
You can also use `kubectl scale`:
```bash
$ kubectl scale --replicas=5 -f 06-deployment/01-simple-deployment.yml
```
You can also edit the configuration in place with `kubectl edit`:
```bash
$ kubectl edit deployment simple-deployment
```
What is happening? What changed?
You can use the flag `--watch` to `kubectl`, for example: `kubectl get pod --watch`.
Do not forget the `kubectl logs [...]` command.

View File

@ -63,7 +63,14 @@ Let's have a look a the configuration:
* `kind`: A `service` has the kind `Service`
* `spec`:
* `ports`: the list of ports to expose. Here we export `port` `1234`, but redirect internally all traffic to the `targetPort` `9876`
* `selector`: **TODO**
* `selector`: which pods to give access to
The selector part,
```yml
selector:
app: simple-service
```
is central to k8s. It is with this field that you will tell k8s which pods to give access through this `service`.
Apply the service:
```bash
@ -145,6 +152,7 @@ With this configuration we have a `deployment` that manages pods. A `service` th
2. Read [this](https://kubernetes.io/docs/concepts/services-networking/ingress/#simple-fanout) and modify the ingress to have:
* `/simple` that goes to the `simple-service`
* `/nginx` that goes to your nginx deployment
3. Change the `selector` in your `simple-service` look at what is happening
## Clean up