- Prerequisites
- What it is not
- What is Kubernetes? What is it used for?
- Glossary
- The base building block: pods
- Naming things: labels and annotations
- Deploying your first application: deployment
- Accessing your first application: service
- Running a background process: cronjobs
- Secrets
- Liveness and readiness probes, and how it impacts your pods
- Resources, and how it impacts the scheduling
- Improving the availability of your application: affinity and anti-affinity
- Improving the availability of your application: pod disruptions budget
- Improving the elasticity of your applications: HPA, VPA
- Sidecar containers: what, why, and how
- Running a stateful application: volumes
- Running a stateful application: stateful-sets
- Controllers: what, why, and how
- Operators and CRDs: what, why, and how
- RBAC
- Other topics
- Good practices
- Links
This hands-on course in under the CC BY-NC-SA license.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
open https://download.docker.com/mac/stable/Docker.dmg
-
VirtualBox: https://www.virtualbox.org/wiki/Downloads
-
minikube: https://github.com/kubernetes/minikube
Install minikube and the "ingress" and "metrics-server" addons:
$ brew install kubectl
[...]
$ brew cask install minikube
[...]
$ minikube start
[...]
🏄 Done! Thank you for using minikube!
$ minikube addons enable ingress
âś… ingress was successfully enabled
$ minikube addons enable metrics-server
âś… metrics-server was successfully enabled
$ kubectl config current-context
minikube
Note: the ingress addon is currently not supported on docker for Mac (see kubernetes/minikube#7332). As a workaround, you have to deploy minikube as a VM and not as a container (using Virtualbox or Hyperkit for example)
$ minikube start --vm=true --vm-driver=virtualbox
[...]
✨ Using the virtualbox driver based on user configuration
🔥 Creating virtualbox VM ...
If you did launch minikube already, the --vm
flag may be ignored as minikube caches the previous config. If so you may want to delete and relaunch minikube (warning: it will delete your whole minikube setup)
$ minikube stop && minikube delete && minikube start --vm=true --vm-driver=virtualbox
[...]
đź’€ Removed all traces of the "minikube" cluster.
✨ Using the virtualbox driver based on user configuration
🔥 Creating virtualbox VM ...
You can try another lighter virtual machine layer than Virtualbox
brew install docker-machine-driver-hyperkit
Then start minikube:
minikube start --vm-driver=hyperkit
If you're encountering any issues:
rm -rf ~/.minikube/
And start minikube without HyperKit:
minikube start
If you are using Zsh, you can add the following to your .zshrc
file to get autocomplete for kubectl
:
if [ $commands[kubectl] ]; then
source <(kubectl completion zsh)
fi
This is a hands-on course to get started with Kubernetes (Kubernetes). It starts with the basics and moves up in complexity. At the end of this course, you should be able to deploy an API in Kubernetes that is accessible from the outside.
This is not a course on how to install, manage or deploy a Kubernetes cluster. Neither is it a course to understand how Kubernetes works internally. However, if you're interested in this topic, see Kubernetes The Hard Way.
Kubernetes is an open-source system for managing containerized applications across multiple hosts, providing basic mechanisms for deployment, maintenance, and scaling of applications.
Kubernetes has a number of features. It can be seen as:
- a container platform,
- a microservices platform,
- a portable cloud platform, and a lot more.
Kubernetes provides a container-centric management environment. It orchestrates computing, networking, and storage infrastructure on behalf of user workloads. This provides much of the simplicity of Platform as a Service (PaaS) with the flexibility of Infrastructure as a Service (IaaS), and enables portability across infrastructure providers.
- YAML (yml)
A markup language that relies on spaces and tabulations. All Kubernetes configuration is written using YAML.
You will feel the pain of missing tabs and spaces. Feel free to use a linter, such as http://www.yamllint.com/.
- Container
Containers are an abstraction at the app layer, which packages code and dependencies together.
- (Container) image
A lightweight, standalone, executable software package that includes everything you need to run an application: code, runtime, system tools, system libraries and settings.
- Docker
A software technology providing operating-system-level virtualization, also known as containers.
Docker uses the resource isolation features of the Linux kernel, such as cgroups and kernel namespaces, and a union-capable file system such as OverlayFS and others to allow independent “containers” to run within a single Linux instance. This avoids the overhead of starting and maintaining virtual machines (VMs).
- kubectl
The standard CLI to interact with Kubernetes. We use it a lot in this course.
- minikube
A local Kubernetes cluster, useful for testing. We use it a lot in this course.
- Manifest
Kubernetes configuration files are called manifests. This is a reference to the list or invoice of the passengers or goods being carried by a commercial vehicle or ship (from wiktionary).
- (Kubernetes) objects
Kubernetes contains a number of abstractions that represent the state of your system: deployed containerized applications and workloads, their associated network and disk resources, and other information about what your cluster is doing. These abstractions are called objects, and are represented by a kind in the Kubernetes API.
- (Kubernetes) node
A node is a worker machine in Kubernetes.
A worker machine may be a VM or physical machine, depending on the cluster. It has the necessary services to run the workloads and is managed by the master components. The services on a node include Docker, kubelet
and kube-proxy
.
- (Kubernetes) cluster
A set of machines, called nodes, that run containerized applications managed by Kubernetes.
A cluster has several worker nodes and at least one master node.
- (Kubernetes) master
The master is responsible for managing the cluster. It coordinates all activities in your cluster, such as scheduling applications, maintaining applications’ desired state, scaling applications, and rolling out new updates.
A Kubernetes master automatically handles the scheduling of your services across nodes in the cluster. The master’s automatic scheduling takes the available resources of each node into account.
See the dedicated README.
See the dedicated README.
See the dedicated README.
See the dedicated README.
See the dedicated README.
See the dedicated README.
See the dedicated README.
See the dedicated README.
See the dedicated README.
See the dedicated README.
See the dedicated README.
See the dedicated README.
See the dedicated README.
See the dedicated README.
See the dedicated README.
See the dedicated README.
See the dedicated README.
See the dedicated README.
See the dedicated README.
- http://kubernetesbyexample.com/
- https://kubernetes.io/docs/home/
- https://kubernetes.io/docs/reference/kubectl/cheatsheet/
- https://hub.docker.com/r/mhausenblas/simpleservice/