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 ` + + - 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 writing YAML + +--- + ## Viewing logs of multiple pods - When we specify a deployment name, only one single pod's logs are shown 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`) 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/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[ 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