diff --git a/k8s/kaniko-build.yaml b/k8s/kaniko-build.yaml index f6b95b54..51eccc49 100644 --- a/k8s/kaniko-build.yaml +++ b/k8s/kaniko-build.yaml @@ -19,7 +19,7 @@ spec: image: gcr.io/kaniko-project/executor:latest args: - "--context=/workspace/dockercoins/rng" - - "--insecure-skip-tls-verify" + - "--skip-tls-verify" - "--destination=registry:5000/rng-kaniko:latest" volumeMounts: - name: workspace diff --git a/prepare-vms/settings/fundamentals.yaml b/prepare-vms/settings/fundamentals.yaml index 05bddb54..63c89f95 100644 --- a/prepare-vms/settings/fundamentals.yaml +++ b/prepare-vms/settings/fundamentals.yaml @@ -20,8 +20,8 @@ paper_margin: 0.2in engine_version: stable # These correspond to the version numbers visible on their respective GitHub release pages -compose_version: 1.21.1 -machine_version: 0.14.0 +compose_version: 1.22.0 +machine_version: 0.15.0 # Password used to connect with the "docker user" -docker_user_password: training \ No newline at end of file +docker_user_password: training diff --git a/slides/count-slides.py b/slides/count-slides.py index 20fd6d90..bef11b36 100755 --- a/slides/count-slides.py +++ b/slides/count-slides.py @@ -51,7 +51,7 @@ for line in open(sys.argv[1]): state.show() -for chapter in sorted(state.chapters): +for chapter in sorted(state.chapters, key=lambda f: int(f.split("-")[1])): chapter_size = sum(state.sections[s] for s in state.chapters[chapter]) print("{}\t{}\t{}".format("total size for", chapter, chapter_size)) diff --git a/slides/k8s/authn-authz.md b/slides/k8s/authn-authz.md index 019537bc..1040e13c 100644 --- a/slides/k8s/authn-authz.md +++ b/slides/k8s/authn-authz.md @@ -216,7 +216,7 @@ class: extra-details - View the secret: ```bash - kubectl get $SECRET -o yaml + kubectl get secret $SECRET -o yaml ``` - Extract the token and decode it: @@ -501,10 +501,14 @@ It's important to note a couple of details in these flags ... ``` - But that we can't create things: - ```bash + ``` ./kubectl run tryme --image=nginx ``` +- Exit the container with `exit` or `^D` + + + ] --- diff --git a/slides/k8s/build-with-docker.md b/slides/k8s/build-with-docker.md index 4948fc2a..ec2e9a20 100644 --- a/slides/k8s/build-with-docker.md +++ b/slides/k8s/build-with-docker.md @@ -107,6 +107,11 @@ spec: stern build-image ``` + + ] --- diff --git a/slides/k8s/build-with-kaniko.md b/slides/k8s/build-with-kaniko.md index b3245f91..be28a94a 100644 --- a/slides/k8s/build-with-kaniko.md +++ b/slides/k8s/build-with-kaniko.md @@ -54,7 +54,7 @@ -v ~/container.training/dockercoins/worker:/workspace \ gcr.io/kaniko-project/executor \ --context=/workspace \ - --destination=127.0.0.1:30448/worker-kaniko:latest + --destination=127.0.0.1:$PORT/worker-kaniko:latest ``` ] @@ -128,7 +128,7 @@ spec: image: gcr.io/kaniko-project/executor:latest args: - "--context=/workspace/dockercoins/rng" - - "--insecure-skip-tls-verify" + - "--insecure" - "--destination=registry:5000/rng-kaniko:latest" volumeMounts: - name: workspace @@ -152,7 +152,7 @@ spec: - We use our self-hosted registry DNS name (`registry`) -- We add `--insecure-skip-tls-verify` since our registry doesn't have TLS certs +- We add `--insecure` to use plain HTTP to talk to the registry --- @@ -172,6 +172,11 @@ spec: stern kaniko ``` + + ] --- diff --git a/slides/k8s/configuration.md b/slides/k8s/configuration.md index b0ce5613..0948b286 100644 --- a/slides/k8s/configuration.md +++ b/slides/k8s/configuration.md @@ -335,14 +335,19 @@ We'll cover them just after!* .exercise[ +- Go to the `k8s` directory in the repository: + ```bash + cd ~/container.training/k8s + ``` + - Create a configmap named `haproxy` and holding the configuration file: ```bash - kubectl create configmap haproxy --from-file=~/container.training/k8s/haproxy.cfg + kubectl create configmap haproxy --from-file=haproxy.cfg ``` - Check what our configmap looks like: ```bash - kuebectl get configmap haproxy -o yaml + kubectl get configmap haproxy -o yaml ``` ] @@ -384,6 +389,8 @@ spec: kubectl apply -f ~/container.training/k8s/haproxy.yaml ``` + + - Check the IP address allocated to the pod: ```bash kubectl get pod haproxy -o wide @@ -442,7 +449,7 @@ We should see connections served by Google (look for the `Location` header) and - Check our configmap: ```bash - kubectl get configmap regsitry -o yaml + kubectl get configmap registry -o yaml ``` ] @@ -483,6 +490,8 @@ spec: kubectl apply -f ~/container.training/k8s/registry.yaml ``` + + - Check the IP address allocated to the pod: ```bash kubectl get pod registry -o wide diff --git a/slides/k8s/dashboard.md b/slides/k8s/dashboard.md index cdef44d2..888c1328 100644 --- a/slides/k8s/dashboard.md +++ b/slides/k8s/dashboard.md @@ -95,7 +95,7 @@ You'll want the `3xxxx` port. - Connect to http://oneofournodes:3xxxx/ - + ] diff --git a/slides/k8s/helm.md b/slides/k8s/helm.md index 809d62ef..4ca6c789 100644 --- a/slides/k8s/helm.md +++ b/slides/k8s/helm.md @@ -224,7 +224,7 @@ The chart's metadata includes an URL to the project's home page. .exercise[ - Let's install our helm chart! (`dockercoins` is the path to the chart) - ```bash + ``` helm install dockercoins ``` ] diff --git a/slides/k8s/kubectlproxy.md b/slides/k8s/kubectlproxy.md index 883f6e50..749f8c0e 100644 --- a/slides/k8s/kubectlproxy.md +++ b/slides/k8s/kubectlproxy.md @@ -99,6 +99,11 @@ If we wanted to talk to the API, we would need to: curl localhost:8001 ``` + + - Terminate the proxy: ```bash kill %1 @@ -155,7 +160,7 @@ The output is a list of available API routes. (and copy credentials, e.g. `~/.kube/config`, to that place) -- It is even better to use a limited account with reduced permissions +- It is even better to use a limited account with reduced permissions --- diff --git a/slides/k8s/localkubeconfig.md b/slides/k8s/localkubeconfig.md index cdcd6ae8..99d262f0 100644 --- a/slides/k8s/localkubeconfig.md +++ b/slides/k8s/localkubeconfig.md @@ -78,7 +78,7 @@ Platform:"linux/amd64"} .exercise[ - Copy the file from `node1`; if you are using macOS or Linux, you can do: - ```bash + ``` scp `USER`@`X.X.X.X`:.kube/config ~/.kube/config # Make sure to replace X.X.X.X with the IP address of node1, # and USER with the user name used to log into node1! diff --git a/slides/k8s/logs-cli.md b/slides/k8s/logs-cli.md index 1a91f6f5..732d83f4 100644 --- a/slides/k8s/logs-cli.md +++ b/slides/k8s/logs-cli.md @@ -85,6 +85,11 @@ Exactly what we need! stern rng ``` + + ] --- @@ -105,6 +110,12 @@ Exactly what we need! ```bash stern --tail 1 --timestamps --all-namespaces weave ``` + + + ] --- @@ -126,4 +137,9 @@ Exactly what we need! stern -l run ``` + + ] diff --git a/slides/k8s/namespaces.md b/slides/k8s/namespaces.md index 87b5b546..e08d007c 100644 --- a/slides/k8s/namespaces.md +++ b/slides/k8s/namespaces.md @@ -200,3 +200,23 @@ Note: it might take a minute or two for the app to be up and running. - the [Kubernetes documentation about network policies](https://kubernetes.io/docs/concepts/services-networking/network-policies/) - this [talk about network policies at KubeCon 2017 US](https://www.youtube.com/watch?v=3gGpMmYeEO8) by [@ahmetb](https://twitter.com/ahmetb) + +--- + +## Switch back to the default namespace + +- Let's make sure that we don't run future exercises in the `blue` namespace + +.exercise[ + +- View the names of the contexts: + ```bash + kubectl config get-contexts + ``` + +- Switch back to the original context: + ```bash + kubectl config use-context kubernetes-admin@kubernetes + ``` + +] diff --git a/slides/k8s/netpol.md b/slides/k8s/netpol.md index bb05b8a0..b42279cf 100644 --- a/slides/k8s/netpol.md +++ b/slides/k8s/netpol.md @@ -188,7 +188,7 @@ spec: - Apply another policy: ```bash - kubectl apply -f ~/container.training/netpol-allow-testcurl-for-testweb.yaml + kubectl apply -f ~/container.training/k8s/netpol-allow-testcurl-for-testweb.yaml ``` ] diff --git a/slides/k8s/owners-and-dependents.md b/slides/k8s/owners-and-dependents.md index 7a7c2fc2..78e6f745 100644 --- a/slides/k8s/owners-and-dependents.md +++ b/slides/k8s/owners-and-dependents.md @@ -29,7 +29,7 @@ - Once it's up, check the corresponding pods: ```bash - kuebectl get pods -l run=yanginx -o yaml | head -n 25 + kubectl get pods -l run=yanginx -o yaml | head -n 25 ``` ] diff --git a/slides/k8s/portworx.md b/slides/k8s/portworx.md index 001ea848..86d83d15 100644 --- a/slides/k8s/portworx.md +++ b/slides/k8s/portworx.md @@ -180,6 +180,30 @@ If you want to use an external key/value store, add one of the following: --- +## Waiting for Portworx to be ready + +- The installation process will take a few minutes + +.exercise[ + +- Check out the logs: + ```bash + stern -n kube-system portworx + ``` + +- Wait until it gets quiet + + (you should see `portworx service is healthy`, too) + + + +] + +--- + ## Dynamic provisioning of persistent volumes - We are going to run PostgreSQL in a Stateful set @@ -330,6 +354,8 @@ spec: kubectl apply -f ~/container.training/k8s/postgres.yaml ``` + + ] --- @@ -347,6 +373,13 @@ spec: kubectl exec -ti postgres-0 su postgres ``` + + - Check that default databases have been created correctly: ```bash psql -l @@ -398,6 +431,8 @@ spec: psql demo -c "select count(*) from pgbench_accounts" ``` + + ] (We should see a count of 1,000,000 rows.) @@ -412,7 +447,7 @@ spec: - Check the node running the database: ```bash - kuebectl get pod postgres-0 -o wide + kubectl get pod postgres-0 -o wide ``` ] @@ -453,12 +488,14 @@ By "disrupt" we mean: "disconnect it from the network". .exercise[ - Check that the node can't communicate with other nodes: - ```bash - ping -c 3 node1 + ``` + ping node1 ``` - Logout to go back on `node1` +> + - Watch the events unfolding with `kubectl get events -w` and `kubectl get pods -w` ] @@ -482,11 +519,19 @@ By "disrupt" we mean: "disconnect it from the network". kubectl exec -ti postgres-0 su postgres ``` + + - Check the number of rows in the `pgbench_accounts` table: ```bash - psql demo -c "select count(*) from pgbench_accounts + psql demo -c "select count(*) from pgbench_accounts" ``` + + ] --- diff --git a/slides/k8s/prometheus.md b/slides/k8s/prometheus.md index 7a3e12e1..43c49c03 100644 --- a/slides/k8s/prometheus.md +++ b/slides/k8s/prometheus.md @@ -235,7 +235,7 @@ The provided flags: - Figure out the NodePort that was allocated to the Prometheus server: ```bash - kubectl get svc prometheus-server + kubectl get svc | grep prometheus-server ``` - With your browser, connect to that port diff --git a/slides/k8s/statefulsets.md b/slides/k8s/statefulsets.md index b997c1c1..856b5934 100644 --- a/slides/k8s/statefulsets.md +++ b/slides/k8s/statefulsets.md @@ -356,6 +356,11 @@ nodes and encryption of gossip traffic) were removed for simplicity. stern consul ``` + + - Check the health of the cluster: ```bash kubectl exec consul-0 consul members