Exit

Guide

Kubernetes 101

What Kubernetes is, what problems it solves, and how it is composed and start using it.

A short primer before anything edge-specific.

What it is

Kubernetes is an open-source container orchestrator. It joins several machines into one cluster and takes care of deploying, scaling and managing containerised applications through a standard API.

Why use it, and when not to use it

  • Resilience. With several nodes, workloads move elsewhere when a machine fails.
  • Scaling. An application runs as one or many containers behind the same API.
  • Service discovery. Workloads find each other by name, not by hand-managed IP addresses.
  • Consistency. The same manifests deploy on-premise, in the cloud, or across both.

And when not to:

  • One app on one box. Docker Compose or systemd is simpler and enough.
  • Nobody to run it. Kubernetes is a platform to operate, not a tool to install. The learning curve is real, and so is the day-two work.
  • Hard real time. It schedules containers. It does not replace a PLC or a real-time OS.

Brief history

Inside Google
2003Borg runs Search, Gmail and Maps: declarative workloads, scheduling, self-healing.
2006Google contributes cgroups to Linux, the isolation containers rely on.
2013Docker makes containers easy. “Project Seven”, Borg’s open-source successor, starts.
Internal experience2003 – 2013

An extensible product...

The API is the contract. Every object has a path on it, operators add their own kinds, and runtime, network and storage are swappable behind standard interfaces. Like Linux, it comes in many distributions.

...based on a reconciliation principle

Desired stateWhat you declare
kind: Deploymentname: webreplicas: 2

Control plane and data plane

Kubernetes cluster

Hands-on

Exercises in k8s-101-exercices: a folder each, with README, manifests and a check script. Work in your own namespace on the shared k3s cluster.

  1. Hello. Two replicas. Delete a pod by hand, watch it come back.
  2. Service. A NodePort in front, reached from outside and by name inside.
  3. ConfigMap. Config out of the image. Which changes need a rollout?
  4. Init containers. Wait for a dependency, seed a volume, then start.
  5. Break it. Wrong image tag, failing probe. Describe, logs, events, fix.

Key tools

CLI:

  • kubectl, the go-to for quick debug and inspection.
  • k9s, lens, tool to visualise cluster state

Application packaging:

  • kustomize native templates
  • helm app templating, client side
  • kro app templating, server side

GitOps

  • flux, unix-style & lighweight controllers
  • argocd, dev friendly app & UI

What GitOps is exactly?

Youedit a manifest, open a PR, merge
git push
Git repository the source of truth
v1web: first deploy