Skip to content
Kubernetes Hands-on by Algolia
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci chore: add ci (#21) May 15, 2019
05-pods fix: simpleservice endpoints (#37) May 23, 2019
06-label-annotation chore: cleanup md, remove empty sections (#32) May 21, 2019
07-deployment fix: fix services names (#49) May 23, 2019
08-service fix: fix services names (#49) May 23, 2019
09-cronjob fix: use sh in md (#28) May 21, 2019
10-secrets Add how to look up the secrets in both cases (#41) May 23, 2019
11-probes fix typos (#42) May 23, 2019
12-resources fix(resources): add explanation on error message (#51) May 24, 2019
13-affinity-anti-affinity chore(affinity): fix typo (#46) May 23, 2019
14-pdb Update README.md (#45) May 23, 2019
15-hpa-vpa chore: cleanup md, remove empty sections (#32) May 21, 2019
16-sidecar-containers fix sidecar manifest (#44) May 23, 2019
17-volumes remove wrong directory in kubectl apply examples in volumes (#47) May 23, 2019
18-stateful-sets docs(stateful-sets): fix folder name (#48) May 23, 2019
19-controllers feat: add controllers (#33) May 21, 2019
20-operators feat: add operators (#50) May 24, 2019
21-rbac fix: use sh in md (#28) May 21, 2019
98-other-topics chore: cleanup md, remove empty sections (#32) May 21, 2019
99-good-practices fix: good practices links (#52) Jun 5, 2019
.markdownlint.yml chore: lint yaml (#19) May 14, 2019
.yamllint chore: lint yaml (#19) May 14, 2019
LICENSE feat: add license May 9, 2019
README.md fix: readme for kubectl (#39) May 23, 2019

README.md

Kubernetes Hands on

  1. Prerequisites
  2. What it is not
  3. What is Kubernetes? What is it used for?
  4. Glossary
  5. The base building block: pods
  6. Naming things: labels and annotations
  7. Deploying your first application: deployment
  8. Accessing your first application: service
  9. Running a background process: cronjobs
  10. Secrets
  11. Liveness and readiness probes, and how it impacts your pods
  12. Resources, and how it impacts the scheduling
  13. Improving the availability of your application: affinity and anti-affinity
  14. Improving the availability of your application: pod disruptions budget
  15. Improving the elasticity of your applications: HPA, VPA
  16. Sidecar containers: what, why, and how
  17. Running a stateful application: volumes
  18. Running a stateful application: stateful-sets
  19. Controllers: what, why, and how
  20. Operators and CRDs: what, why, and how
  21. RBAC
  22. Other topics
  23. Good practices
  24. Links

License

This hands-on course in under the CC BY-NC-SA license.

CC BY-NC-SA

Prerequisites

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
open https://download.docker.com/mac/stable/Docker.dmg

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

(Optional) If you feel adventurous, only for macOS

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

Completion

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

What this course is and what it's not

What this is

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.

What it's not

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.

What is Kubernetes? What is it used for

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.

Glossary

  • 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.

The base building block: pods

See the dedicated README.

Naming things: labels and annotations

See the dedicated README.

Deploying my first application: deployment

See the dedicated README.

Accessing my first application: service

See the dedicated README.

Running a background process: cronjobs

See the dedicated README.

Secrets

See the dedicated README.

Liveness and readiness probes, and how it impacts your pods

See the dedicated README.

Resources, and how it impacts the scheduling

See the dedicated README.

Affinity and anti-affinity

See the dedicated README.

PDB

See the dedicated README.

HPA, VPA

See the dedicated README.

Sidecar containers: what, why, and how

See the dedicated README.

Running a stateful application: volumes

See the dedicated README.

Running a stateful application: stateful sets

See the dedicated README.

Controllers: what, why, and how

See the dedicated README.

Operators and CRDs: what, why, and how

See the dedicated README.

RBAC

See the dedicated README.

Other topics

See the dedicated README.

Good practices

See the dedicated README.

Links

You can’t perform that action at this time.