From 3c1220be832a8caf24b957b4910034a4b8f1b848 Mon Sep 17 00:00:00 2001 From: Jerome Petazzoni Date: Mon, 13 Jan 2020 17:43:24 -0600 Subject: [PATCH 1/2] Replace 1.1 with 127.1 This avoids pinging an external machine --- slides/k8s/kubectlrun.md | 44 +++++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/slides/k8s/kubectlrun.md b/slides/k8s/kubectlrun.md index 9b7ae2ec..d16e9b5e 100644 --- a/slides/k8s/kubectlrun.md +++ b/slides/k8s/kubectlrun.md @@ -20,10 +20,9 @@ .exercise[ -- Let's ping `1.1.1.1`, Cloudflare's - [public DNS resolver](https://blog.cloudflare.com/announcing-1111/): +- Let's ping the address of `localhost`, the loopback interface: ```bash - kubectl run pingpong --image alpine ping 1.1.1.1 + kubectl run pingpong --image alpine ping 127.0.0.1 ``` @@ -367,12 +366,12 @@ Let's leave `kubectl logs` running while we keep exploring. ## Various ways of creating resources -- `kubectl run` +- `kubectl run` - easy way to get started - versatile -- `kubectl create ` +- `kubectl create ` - explicit, but lacks some features - can't create a CronJob before Kubernetes 1.14 @@ -516,15 +515,36 @@ class: extra-details --- -## Aren't we flooding 1.1.1.1? +class: extra-details -- If you're wondering this, good question! +## Party tricks involving IP addresses -- Don't worry, though: +- It is possible to specify an IP address with less than 4 bytes - *APNIC's research group held the IP addresses 1.1.1.1 and 1.0.0.1. While the addresses were valid, so many people had entered them into various random systems that they were continuously overwhelmed by a flood of garbage traffic. APNIC wanted to study this garbage traffic but any time they'd tried to announce the IPs, the flood would overwhelm any conventional network.* + (example: `127.1`) - (Source: https://blog.cloudflare.com/announcing-1111/) +- Zeroes are then inserted in the middle -- It's very unlikely that our concerted pings manage to produce - even a modest blip at Cloudflare's NOC! +- As a result, `127.1` expands to `127.0.0.1` + +- So we can `ping 127.1` to ping `localhost`! + +(See [this blog post](https://ma.ttias.be/theres-more-than-one-way-to-write-an-ip-address/ +) for more details.) + +--- + +class: extra-details + +## More party tricks with IP addresses + +- We can also ping `1.1` + +- `1.1` will expand to `1.0.0.1` + +- This is one of the addresses of Cloudflare's + [public DNS resolver](https://blog.cloudflare.com/announcing-1111/) + +- This is a quick way to check connectivity + + (if we can reach 1.1, we probably have internet access) From 5160dd39a0ba949a7a2c9acd3bdcb439095222ff Mon Sep 17 00:00:00 2001 From: Jerome Petazzoni Date: Tue, 14 Jan 2020 15:32:43 -0600 Subject: [PATCH 2/2] Add mention to ctr.run --- slides/containers/Publishing_To_Docker_Hub.md | 22 +++++++++++++++++++ slides/k8s/shippingimages.md | 22 +++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/slides/containers/Publishing_To_Docker_Hub.md b/slides/containers/Publishing_To_Docker_Hub.md index 2e296fc7..c0d2ee5d 100644 --- a/slides/containers/Publishing_To_Docker_Hub.md +++ b/slides/containers/Publishing_To_Docker_Hub.md @@ -100,3 +100,25 @@ class: extra-details * In "Build rules" block near page bottom, put `/www` in "Build Context" column (or whichever directory the Dockerfile is in). * Click "Save and Build" to build the repository immediately (without waiting for a git push). * Subsequent builds will happen automatically, thanks to GitHub hooks. + +--- + +## Building on the fly + +- Some services can build images on the fly from a repository + +- Example: [ctr.run](https://ctr.run/) + +.exercise[ + +- Use ctr.run to automatically build a container image and run it: + ```bash + docker run ctr.run/github.com/undefinedlabs/hello-world + ``` + +] + +There might be a long pause before the first layer is pulled, +because the API behind `docker pull` doesn't allow to stream build logs, and there is no feedback during the build. + +It is possible to view the build logs by setting up an account on [ctr.run](https://ctr.run/). diff --git a/slides/k8s/shippingimages.md b/slides/k8s/shippingimages.md index 7e7245eb..2529a303 100644 --- a/slides/k8s/shippingimages.md +++ b/slides/k8s/shippingimages.md @@ -89,3 +89,25 @@ - When picking a registry, pay attention to its build system (when it has one) + +--- + +## Building on the fly + +- Some services can build images on the fly from a repository + +- Example: [ctr.run](https://ctr.run/) + +.exercise[ + +- Use ctr.run to automatically build a container image and run it: + ```bash + docker run ctr.run/github.com/jpetazzo/container.training/dockercoins/hasher + ``` + +] + +There might be a long pause before the first layer is pulled, +because the API behind `docker pull` doesn't allow to stream build logs, and there is no feedback during the build. + +It is possible to view the build logs by setting up an account on [ctr.run](https://ctr.run/). \ No newline at end of file