From 4b0ac6d0e3a1253d77fd47789e737aa4d1c31c16 Mon Sep 17 00:00:00 2001 From: Jerome Petazzoni Date: Fri, 28 Sep 2018 19:49:08 -0500 Subject: [PATCH 1/7] Add a couple of slides about kubens and kubectx --- slides/k8s/namespaces.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/slides/k8s/namespaces.md b/slides/k8s/namespaces.md index 6c82b7bb..f4c949a8 100644 --- a/slides/k8s/namespaces.md +++ b/slides/k8s/namespaces.md @@ -192,3 +192,38 @@ Note: it might take a minute or two for the app to be up and running. ``` ] + +--- + +## Switching namespaces more easily + +- Defining a new context for each namespace can be cumbersome + +- We can also alter the current context with this one-liner: + + ```bash + kubectl config set-context --current --namespace=foo + ``` + +- We can also use a little helper tool called `kubens`: + + ```bash + # Switch to namespace foo + kubens foo + # Switch back to the previous namespace + kubens - + ``` + +--- + +## `kubens` and `kubectx` + +- With `kubens`, we can switch quickly between namespaces + +- With `kubectx`, we can switch quickly between contexts + +- Both tools are simple shell scripts available from https://github.com/ahmetb/kubectx + +- On our clusters, they are installed as `kns` and `kctx` + + (for brevity and to avoid completion clashes between `kubectx` and `kubectl`) From 2f1ad67fb32636e0fb331f7f88766d772e3a695c Mon Sep 17 00:00:00 2001 From: Jerome Petazzoni Date: Fri, 28 Sep 2018 20:54:11 -0500 Subject: [PATCH 2/7] Add explanation about the kubectl run deprecation warning --- slides/k8s/kubectlrun.md | 41 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/slides/k8s/kubectlrun.md b/slides/k8s/kubectlrun.md index b082b866..b842ad6b 100644 --- a/slides/k8s/kubectlrun.md +++ b/slides/k8s/kubectlrun.md @@ -32,7 +32,8 @@ -- -OK, what just happened? +(Starting with Kubernetes 1.12, we get a message telling us that +`kubectl run` is deprecated. Let's ignore it for now.) --- @@ -228,6 +229,44 @@ We could! But the *deployment* would notice it right away, and scale back to the --- +## What about that deprecation warning? + +- As we can see from the previous slide, `kubectl run` can do many things + +- The exact type of resource created is not obvious + +- To make things more explicit, it is better to use `kubectl create`: + + - `kubectl create deployment` to create a deployment + + - `kubectl create job` to create a job + +- Eventually, `kubectl run` will be used only to start one-shot pods + + (see https://github.com/kubernetes/kubernetes/pull/68132) + +--- + +## Various ways of creating resources + +- `kubectl run` + + - easy way to get started + - versatile + +- `kubectl create ` + + - explicit, but lacks some features + - can't create a CronJob + - can't pass command-line arguments to deployments + +- `kubectl create -f foo.yaml` or `kubectl apply -f foo.yaml` + + - all features are available + - requires to write YAML + +--- + ## Viewing logs of multiple pods - When we specify a deployment name, only one single pod's logs are shown From 0a942118c1d4ca45ad0fe0e18a14c54465bd1d25 Mon Sep 17 00:00:00 2001 From: Bridget Kromhout Date: Fri, 28 Sep 2018 21:32:23 -0500 Subject: [PATCH 3/7] Update kubectlrun.md slight wording change --- slides/k8s/kubectlrun.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slides/k8s/kubectlrun.md b/slides/k8s/kubectlrun.md index b842ad6b..ee142a76 100644 --- a/slides/k8s/kubectlrun.md +++ b/slides/k8s/kubectlrun.md @@ -263,7 +263,7 @@ We could! But the *deployment* would notice it right away, and scale back to the - `kubectl create -f foo.yaml` or `kubectl apply -f foo.yaml` - all features are available - - requires to write YAML + - requires writing YAML --- From 36ccaf7ea4e325a0538e32c8f665480334586ae9 Mon Sep 17 00:00:00 2001 From: Bret Fisher Date: Sat, 29 Sep 2018 00:21:11 -0400 Subject: [PATCH 4/7] update compose/machine versions in swarm nodes --- prepare-vms/settings/swarm.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/prepare-vms/settings/swarm.yaml b/prepare-vms/settings/swarm.yaml index 55636ae0..c60d8566 100644 --- a/prepare-vms/settings/swarm.yaml +++ b/prepare-vms/settings/swarm.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 From 100c6b46cfcd65471e37ce240de6b20bfea17ac0 Mon Sep 17 00:00:00 2001 From: Bret Fisher Date: Sat, 29 Sep 2018 00:40:05 -0400 Subject: [PATCH 5/7] oops, updated slide versions --- slides/swarm/versions.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/slides/swarm/versions.md b/slides/swarm/versions.md index b5eb5bbe..8b6603ef 100644 --- a/slides/swarm/versions.md +++ b/slides/swarm/versions.md @@ -1,8 +1,8 @@ ## Brand new versions! -- Engine 18.03 -- Compose 1.21 -- Machine 0.14 +- Engine 18.06 +- Compose 1.22 +- Machine 0.15 .exercise[ From 35614714c874a1134e2c7e578a9c9299355a7e1a Mon Sep 17 00:00:00 2001 From: Bret Fisher Date: Sat, 29 Sep 2018 02:11:48 -0400 Subject: [PATCH 6/7] added portainer setup and gui options --- slides/swarm-fullday.yml | 1 + slides/swarm/gui.md | 51 ++++++++++++++++++++++++++++++++++++++++ stacks/portainer.yml | 15 ++++++++++++ 3 files changed, 67 insertions(+) create mode 100644 slides/swarm/gui.md create mode 100644 stacks/portainer.yml diff --git a/slides/swarm-fullday.yml b/slides/swarm-fullday.yml index 7627bd08..9a558279 100644 --- a/slides/swarm-fullday.yml +++ b/slides/swarm-fullday.yml @@ -55,6 +55,7 @@ chapters: - swarm/apiscope.md - - swarm/logging.md - swarm/metrics.md + - swarm/gui.md - swarm/stateful.md - swarm/extratips.md - shared/thankyou.md diff --git a/slides/swarm/gui.md b/slides/swarm/gui.md new file mode 100644 index 00000000..05796ba6 --- /dev/null +++ b/slides/swarm/gui.md @@ -0,0 +1,51 @@ +# GUI's: Web Admin of Swarms and Registry + +What about web interfaces to control and manage Swarm? + +- [Docker Enterprise](https://www.docker.com/products/docker-enterprise) is Docker Inc's paid offering, which has GUI's. + +- [Portainer](https://portainer.io) is a popular open source web GUI for Swarm with node agents. + +- [Portus](http://port.us.org) is a SUSE-backed open source web GUI for registry. + +- Find lots of other Swarm tools in the [Awesome Docker list](http://awesome-docker.netlify.com). + +--- + +## Lets deploy Portainer + +- Yet another stack file + +.exercise[ + +- Make sure we are in the stacks directory: + ```bash + cd ~/container.training/stacks + ``` + +- Deploy the Portainer stack: + ```bash + docker stack deploy -c portainer.yml portainer + ``` + +] + +--- + +## View and setup Portainer + +- go to `:9090` + +- You should see the setup UI. Create a 8-digit password. + +- Next, tell Portainer how to connect to docker. + +- We'll use the agent method (one per node). + + - For connection, choose `Agent` + + - Name: `swarm1` + + - Agent URL: `tasks.agent:9001` + +- Let's browse around the interface diff --git a/stacks/portainer.yml b/stacks/portainer.yml new file mode 100644 index 00000000..55e39738 --- /dev/null +++ b/stacks/portainer.yml @@ -0,0 +1,15 @@ +version: "3.4" + +services: + web: + image: portainer/portainer + ports: + - "9000:9000" + agent: + image: portainer/agent + volumes: + - /var/run/docker.sock:/var/run/docker.sock + deploy: + mode: global + environment: + AGENT_CLUSTER_ADDR: tasks.agent From f543b54426eaf2a072f943ed2df0208d63455e32 Mon Sep 17 00:00:00 2001 From: Jerome Petazzoni Date: Sat, 29 Sep 2018 10:06:20 -0500 Subject: [PATCH 7/7] Prepare deployment scripts for Ubuntu 18.04 This adds a few features: - ./workshopctl kubereset TAG (closes #306) - remove python-setuptools (prepare for #353) - ./workshopctl weavetest TAG (help detecting weave issues like we had at OSCON, July 2018) - remove a bit of dead code --- prepare-vms/lib/commands.sh | 53 ++++++++++++++++++++++++++++-------- prepare-vms/lib/infra/aws.sh | 12 +++----- prepare-vms/lib/postprep.py | 3 +- 3 files changed, 47 insertions(+), 21 deletions(-) diff --git a/prepare-vms/lib/commands.sh b/prepare-vms/lib/commands.sh index 39fc91b5..02a959dd 100644 --- a/prepare-vms/lib/commands.sh +++ b/prepare-vms/lib/commands.sh @@ -53,11 +53,18 @@ _cmd_deploy() { echo deploying > tags/$TAG/status sep "Deploying tag $TAG" + + # Wait for cloudinit to be done + pssh " + while [ ! -f /var/lib/cloud/instance/boot-finished ]; do + sleep 1 + done" + + # Copy settings and install Python YAML parser pssh -I tee /tmp/settings.yaml