kubernetes logo

Container Orchestration

What is container Orchestration?

Simply put

We define the resources
(e.g. computing power, network, storage space, etc...)

The services we need

Then the orchestrator does the magic

An example

We have 4 computers, some different storage units,
and we need to deploy 7 Services

We have to tell to Kubernetes (aka K8s)
the "hardware" it can use...

...then, based on the services requirements,
it will deploy and assign the resources to the services

What happens if a computer decides to organize a last minute πŸ”₯barbecueπŸ”₯?

Kubernetes will immediately reschedule the deployment of the missing services on the other available "hardware"

This is only the first of several strengths of K8s

The cluster

When we work with K8s we talk about clusters instead of machines upon which deploy services on

A cluster is a set of the machines (aka nodes), network storages, and other small things

Wait, I have no 50 mighty servers

Does it make sense to have a cluster of one single node?

yes meme

We lose the horizontal scaling related features,
but we preserve the other ones

Maybe, we should choose a lighter K8s alternative (e.g. K0s)

All nodes are created equal

pretty much

We can generally identify
two kinds of roles for nodes

Control plane nodes
which manage the cluster
Worker nodes
on which the pods run

The role of a node is defined
by the components installed on it

Control plane components

kube-apiserver
exposes a REST API to the user to perform
operations on the cluster
etcd
used to store and share cluster information
between control plane nodes
kube-scheduler
schedules the required pods on the specific worker nodes
kube-controller-manager
manages the various cluster controllers
(e.g. node controller, replicaset controller)

πŸ”— more on control plane components

Worker components

kubelet
receives the pods specifications,
takes care of create it and monitors its life cycle
kube-proxy
manages the node networks
Container runtime
(e.g. Docker, Containered, ecc)

πŸ”— more on worker components

cluster schema

Let us assume we have a configured K8s cluster

(How to deploy a cluster is a whole other course)

How can I work with it?

We have to communicate to kube-apiserver

Generally we can locate the file
/etc/kubernetes/admin.conf
on the control plate node

This file contains the administration
configuration
to communicate to the cluster

This is the equivalent to logging in as root, K8s supports granular permissions
πŸ”— read more

Everything starts from kubectl

Let us install it
pacman -Syu kubectl

πŸ”— other installers

Copy the admin.conf content in
~/.kube/config.conf

kubectl get nodes

NAME			STATUS	ROLES					AGE		VERSION
sailor_uranus	Ready	control-plane,master	2h		v1.23.3
sailor_neptune	Ready	<none>					2h		v1.23.3
sailor_saturn	Ready	<none>					2h		v1.23.3
	

We are ready