# Fundamentals 04th-05th October 2022 ## Welcome Welcome to the 2 day Kubernetes Fundamentals workshop from [Control Plane](https://control-plane.io) Slides and exercises will be shared at the end of the course. ## TL;DR ### Links - [Exercises](https://control.training/fundamentals) - [Materials](https://drive.google.com/drive/folders/1KE0ZhTZ-bqp11fO5evVuW1kUFYgzwOPp?usp=sharing) - [Google Cloud Console](https://console.cloud.google.com/) - [Google Cloud Shell](https://shell.cloud.google.com/) ### Trainers - [Ahmed Gaber󠁢󠁷󠁬󠁳󠁿](ahmedgabercp@gmail.com) - [Sophia󠁢 Mexi-Jones󠁷󠁬󠁳󠁿](mailto:sophia.mexi-jones@control-plane.io) ## Schedule > All times BST ### Day 1 | Time (UK) | Task | | ------------ | --------------- | | 09:00 | Setting up | | 09:30 | Introductions | | 09:45 | Container Basics | | 10:30 | **Break** | | 10:45 | Content | | 12:00 | **Lunch** | | 13:00 | Content | | 15:00 | **Break** | | 15:15 | Content | | 16:30 | Quiz | | 17:00 | Closing Day 1 | ### Day 2 | Time (UK) | Task | | ------------ | --------------- | | 09:00 | Setting up | | 09:30 | Content | | 10:30 | **Break** | | 11:00 | Content | | 12:00 | **Lunch** | | 13:00 | Content | | 13:30 | Content | | 15:00 | **Break** | | 15:15 | Content | | 15:45 | Debugging | | 17:00 | Closing Day 2 | ## Videos Videos will be added throughout the course: - [Container Basics](https://vimeo.com/412031802/79eeba76d0) - [Docker Basics](https://vimeo.com/412031593/278e420d68) - [Kubernetes Core Resources slides](https://vimeo.com/407555119/4584cc70e4) - [The Kubernetes Controlplane slides](https://vimeo.com/412029319/fe0b9b53c3) - [Inter-cluster Networking](https://vimeo.com/407554821/cde1e684df) - [Network Policy slides](https://vimeo.com/407554981/ab8ed09aa3) - [Secrets](https://vimeo.com/407555400/7af1c3f6eb) ## Code Snippets Any code that has been discussed will be shared here making it easier to use ## Slide Links ### Container Basics - [What is a Container?](https://www.docker.com/resources/what-container) - [CGROUPS](https://www.kernel.org/doc/Documentation/cgroup-v1/cgroups.txt) - [Demystifying namespaces and containers in Linux](https://opensource.com/article/19/10/namespaces-and-containers-linux) ### Docker Concepts - [Best practices for writing Dockerfiles](https://docs.docker.com/develop/develop-images/dockerfile_best-practices/) - [tianon / dockerfiles](https://github.com/tianon/dockerfiles) - [Lean Go Containers with Multi-Stage Dockerfiles](https://container-solutions.com/lean-go-containers-multi-stage-dockerfiles/) - [jwilder / docker-squash](https://github.com/jwilder/docker-squash) - [Orca build](https://github.com/cyphar/orca-build) - [Hadolint](https://github.com/hadolint/hadolint) - [Docker security non-events](https://docs.docker.com/engine/security/non-events/) ### Core Kubernetes Resources - [kubectl Cheat Sheet](https://kubernetes.io/docs/reference/kubectl/cheatsheet/) - [Configure Liveness, Readiness and Startup Probes](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/) - [Container Networking From Scratch](https://static.sched.com/hosted_files/kccna18/c1/slides.pdf) - [Understanding kubernetes networking: services](https://medium.com/google-cloud/understanding-kubernetes-networking-services-f0cb48e4cc82) - [Learn Kubernetes Basics](https://kubernetes.io/docs/tutorials/kubernetes-basics/) - [The Almighty Pause Container](https://www.ianlewis.org/en/almighty-pause-container) - [Minikube](https://minikube.sigs.k8s.io/docs/start/) ### Control Plane Introduction - [API server ports and IPs](https://kubernetes.io/docs/reference/access-authn-authz/controlling-access/#api-server-ports-and-ips) - [Runway Model Raft](https://runway.systems/?model=github.com/ongardie/runway-model-raft#) - [Kubernetes High Availability: No Single Point of Failure](https://thenewstack.io/kubernetes-high-availability-no-single-point-of-failure/) - [Kube Ops View](https://codeberg.org/hjacobs/kube-ops-view) - [What happens when ... Kubernetes edition!](https://github.com/jamiehannaford/what-happens-when-k8s) - [Kubernetes Networking: How to Write Your Own CNI Plug-in with Bash](https://www.altoros.com/blog/kubernetes-networking-writing-your-own-simple-cni-plug-in-with-bash/) ## Training links > References to tools during training: - [Distroless](https://github.com/GoogleContainerTools/distroless) - [kubectx](https://github.com/ahmetb/kubectx) - helps manage which cluster/namespace that you're connecting onto - [dive](https://github.com/wagoodman/dive) - review the images that you've pulled down - [k9s](https://k9scli.io/) - [Strangler Fig Pattern](https://martinfowler.com/bliki/StranglerFigApplication.html)# ## CNI Plug in issue kubectl apply -f https://github.com/weaveworks/weave/releases/download/v2.8.1/weave-daemonset-k8s-1.11.yaml ## Docker Debug > Please try to find the flags :smile: ### Scenario 0 ```bash= docker run -d --name inspect denhamparry/workshop:0 docker exec -it inspect cat hello.txt ``` ### Scenario 1 ```bash= docker run --rm --name details denhamparry/workshop:1 docker run --rm --name details -e VERSION=13 denhamparry/workshop:1 mkdir -p /tmp/data echo "hello" > /tmp/data/hello.txt docker run --rm --name details -e VERSION=13 -v /tmp/data/:/data denhamparry/workshop:1 echo "13" > /tmp/data/hello.txt docker run --rm --name details -e VERSION=13 -v /tmp/data/:/data denhamparry/workshop:1 ``` ### Scenario 2 ```bash= docker run --rm --name walls denhamparry/workshop:2 docker run --rm --name walls -p 3333:3333 denhamparry/workshop:2 telnet localhost 3333 friend ``` ## History A list of what we have done so far, all times GMT ### Day 1 - 09:00 am - Setup - 09:30 am - Introductions - 09:45 am - Guide to the workshop - 10:00 am - [Container Basics](https://vimeo.com/412031802/79eeba76d0) - [Docker Basics](https://vimeo.com/412031593/278e420d68) - 10:25 am - Review of slides/videos - 10:30 am - Break - 10:45 am - [Container Basics](https://control.training/fundamentals/modules/container-basics/) - 12:00 pm - Lunch - 13:00 pm - Container Basics review - 14:10 pm - [Kubernetes Core Resources slides](https://vimeo.com/407555119/4584cc70e4) - [The Kubernetes Controlplane slides](https://vimeo.com/412029319/fe0b9b53c3) - 14:30 pm - Installing a Cluster with kubeadm walkthrough - 15:00 pm - [Installing a Cluster with kubeadm](https://control.training/fundamentals/modules/installing-a-cluster-with-kubeadm/) - [Core Kubernetes](https://control.training/fundamentals/modules/core-kubernetes/) - 16:30 pm - Quiz - 17:00 pm - --FIN-- ### Day 2 - 9:00 am - Docker Debug - 09:30 am - Core Kubernetes Review - Namespaces / Pods / Deployments - 10:00 am - Demo - 10:30 am - Break - 10:45 - [Inter-cluster Networking](https://vimeo.com/407554821/cde1e684df) - Services - Demo - 12:00 pm - Lunch - 13:00 pm - [Network Policy](https://vimeo.com/407554981/ab8ed09aa3) - [Networking workshop](https://control.training/fundamentals/modules/networking/) - 14:00 pm - [Secrets](https://vimeo.com/407555400/7af1c3f6eb) - Demo - 14:45 pm - Break - 15:00 pm - [Secrets workshop](https://control.training/fundamentals/modules/secrets/) - 17:00 pm - --FIN--