From ed5009c769c581cbf81eee710c816a0a05377828 Mon Sep 17 00:00:00 2001 From: Jerome Petazzoni Date: Thu, 30 Jan 2020 14:44:44 -0600 Subject: [PATCH] Tweaks after Caen --- k8s/nginx-3-with-git.yaml | 2 +- slides/k8s/concepts-k8s.md | 23 ++++++ slides/k8s/daemonset.md | 28 +++---- slides/k8s/ingress.md | 32 +++++-- slides/k8s/kubectlexpose.md | 161 ++++++++++++++++++++++++++++-------- slides/k8s/namespaces.md | 2 - slides/k8s/volumes.md | 4 +- 7 files changed, 189 insertions(+), 63 deletions(-) diff --git a/k8s/nginx-3-with-git.yaml b/k8s/nginx-3-with-git.yaml index c0ed9c96..a3ee90b0 100644 --- a/k8s/nginx-3-with-git.yaml +++ b/k8s/nginx-3-with-git.yaml @@ -13,7 +13,7 @@ spec: mountPath: /usr/share/nginx/html/ - name: git image: alpine - command: [ "sh", "-c", "apk add --no-cache git && git clone https://github.com/octocat/Spoon-Knife /www" ] + command: [ "sh", "-c", "apk add git && git clone https://github.com/octocat/Spoon-Knife /www" ] volumeMounts: - name: www mountPath: /www/ diff --git a/slides/k8s/concepts-k8s.md b/slides/k8s/concepts-k8s.md index 2d07da54..59594145 100644 --- a/slides/k8s/concepts-k8s.md +++ b/slides/k8s/concepts-k8s.md @@ -10,6 +10,29 @@ --- +## What can we do with Kubernetes? + +- Let's imagine that we have a 3-tier e-commerce app: + + - web frontend + + - API backend + + - database (that we will keep out of Kubernetes for now) + +- We have built images for our frontend and backend components + + (e.g. with Dockerfiles and `docker build`) + +- We are running them successfully with a local environment + + (e.g. with Docker Compose) + +- Let's see how we would deploy our app on Kubernetes! + +--- + + ## Basic things we can ask Kubernetes to do -- diff --git a/slides/k8s/daemonset.md b/slides/k8s/daemonset.md index d6668748..fd798bb4 100644 --- a/slides/k8s/daemonset.md +++ b/slides/k8s/daemonset.md @@ -427,7 +427,7 @@ class: extra-details - We need to change the selector of the `rng` service! -- Let's add another label to that selector (e.g. `enabled=yes`) +- Let's add another label to that selector (e.g. `active=yes`) --- @@ -445,11 +445,11 @@ class: extra-details ## The plan -1. Add the label `enabled=yes` to all our `rng` pods +1. Add the label `active=yes` to all our `rng` pods -2. Update the selector for the `rng` service to also include `enabled=yes` +2. Update the selector for the `rng` service to also include `active=yes` -3. Toggle traffic to a pod by manually adding/removing the `enabled` label +3. Toggle traffic to a pod by manually adding/removing the `active` label 4. Profit! @@ -464,7 +464,7 @@ be any interruption.* ## Adding labels to pods -- We want to add the label `enabled=yes` to all pods that have `app=rng` +- We want to add the label `active=yes` to all pods that have `app=rng` - We could edit each pod one by one with `kubectl edit` ... @@ -474,9 +474,9 @@ be any interruption.* .exercise[ -- Add `enabled=yes` to all pods that have `app=rng`: +- Add `active=yes` to all pods that have `app=rng`: ```bash - kubectl label pods -l app=rng enabled=yes + kubectl label pods -l app=rng active=yes ``` ] @@ -495,7 +495,7 @@ be any interruption.* .exercise[ -- Update the service to add `enabled: yes` to its selector: +- Update the service to add `active: yes` to its selector: ```bash kubectl edit service rng ``` @@ -504,7 +504,7 @@ be any interruption.* ```wait Please edit the object below``` ```keys /app: rng``` ```key ^J``` -```keys noenabled: yes``` +```keys noactive: yes``` ```key ^[``` ] ```keys :wq``` ```key ^J``` @@ -530,7 +530,7 @@ be any interruption.* - If we want the string `"42"` or the string `"yes"`, we have to quote them -- So we have to use `enabled: "yes"` +- So we have to use `active: "yes"` .footnote[For a good laugh: if we had used "ja", "oui", "si" ... as the value, it would have worked!] @@ -542,7 +542,7 @@ be any interruption.* - Update the YAML manifest of the service -- Add `enabled: "yes"` to its selector +- Add `active: "yes"` to its selector