Demystifying the Internal Components of Kubernetes

~$ whoami

Denis Germain

@zwindler(@framapiaf.org)

#geek 👨‍💻 #SF 🤖👽 #runner 🏃‍♂️


*the slides are on the blog

Demystifying the Internal Components of Kubernetes

Questions 🚨

"Kubernetes is ✨ magic ✨" 🤩 (no, it's not)

In reality :

  • Manage infrastructure with APIs (& YAML)
  • Applications lifecycle and scale management
  • Native high availability
  • Super extensible

A few notions

Node or Worker : the server running the Pods

Pod : Kubernetes compute unit.
1-n containers sharing 0-n volumes and an IP address

Let's deploy an app!

3 APIs :

What does it look like in YAML?

Cool, but how does it runs really under the hood 🚗 ?

I want to play a game

  • I'm going to deploy a web server in V(lang) using YAML manifests (easy)

  • BUT, we'll deploy before that a Kubernetes cluster, binary by binary first


github.com/zwindler/demystifions-kubernetes

API server

  • Centralize the APIs (extensible)
  • Abstract our infrastructure components

etcd

  • key value database
  • distributed / fault-tolerant (raft)

It's time to D-D-D-D-D-DEMO !

center

"Scotty, I need more power"

Controller Manager

Controllers are independant control loop softwares:

  • Subscribe to events
  • Act on events

center

A few controllers

But also :

  • CRDs / operators
  • storage providers (CSI)

Let's add a controller-manager

center

Scheduler

How does Kubernetes know "where" to put a new Pod?

center

Let's add a scheduler

center

Now we have a working control plane

But where are the Nodes?!

kubelet

  • Send/receive Node information
  • Controls container runtime
    • adds/deletes Pods
    • checks Pods health

Official documentation - kubelet

Container runtime

To run the containers in the pods, we need a container runtime

At first,
(dockershim is unsupported in 1.24)

Often replaced by containerd now, lot's of alternatives!

Internal network

uses iptables, ipvs, ou eBPF to simulate the (virtual) network

center

There is no IP

CNI plugin

  • Container Network Interface
  • Kubernetes internal network
  • CNI plugins = implementations of the CNI

kube-proxy (optional)

Component responsible of creating/managing dynamically iptables rules to route trafic from Services to living Pods

center

We only need one more thing, I promise 🙃

center

IngressController

Routing HTTP(S) requests

  • IngressController is a third party component managing Ingress

Note: Ingress API is being replaced by tge Gateway API (more powerful and more agnostic)

End of the demo

center

is "only"

  • an API server
  • a scheduler
  • control loops
  • a container runtime
  • a virtual network

@zwindler(@framapiaf.org)

Slides and sources on blog.zwindler.fr/conférences

Sources

Sources / articles

Backup slides

Talks / conferences on the same topic

What is a container ?

It's a box! 😂

  • Process (or software)
  • Run by "runtime"
  • Isolated from other process on host
  • Not only !
    (microVMs, container , WASM ...)

What is Kubernetes?

  • Container orchestrator
  • Inspired by a Google production tool
  • Open sourced and given to the CNCF in 2015
  • Won the "orchestrator war"
    • Docker swarm
    • Mesos Marathon