03 - Kubernetes Architecture
03 - Kubernetes Architecture
explained
by
Table of Contents
INTRODUCTION TO KUBERNETES 2
Basic architecture: Control Plane and Worker Nodes
- - - - X
Kubernetes is a complete framework, which is very powerful but at the same time
very complex. 🤯 A lot of people get overwhelmed when they read the
documentation of Kubernetes: How is the Kubernetes mechanism built? How do all
the processes inside that mechanism work, that make it possible to manage and
orchestrate the containers?
We also go through the basic concepts of how Kubernetes does what it does and how
its mechanism makes the cluster self-managed, self-healing and automated.
Finally, you will understand how you as an operator of the Kubernetes cluster
should end up having much less manual effort. 😎
INTRODUCTION TO KUBERNETES 3
Worker Nodes - 3 processes
- - - - X
One of the main components of the Kubernetes architecture is its Worker servers -
which are called Nodes in Kubernetes. Each Node runs multiple application Pods
with containers inside. So these pods and containers all run on worker nodes.
The way it works is that each worker node has 3 processes that
must be installed on every Node:
1) Container Runtime
2) Kubelet
3) Kube-proxy
1) Container runtime 🐳
The first process that needs to run on every Node is the container runtime, for
example Docker, but it could be some other technology as well.
INTRODUCTION TO KUBERNETES 4
2) Kubelet
The process that actually starts those Pods and the containers on the server is
Kubelet, which is a process of Kubernetes itself, unlike container runtime. Kubelet
has an interface with both: the container runtime and the server or the Node itself.
Why? because Kubelet needs to get resources, like CPU, RAM and storage, from the
worker node to create a Pod and then it needs to talk to Docker to start a container
inside the pod.
Usually a Kubernetes cluster is made up of multiple Nodes, which all have container
runtime and Kubelet installed. You can have hundreds of those Worker Nodes,
which will run other Pods and containers or multiple replicas of the existing Pods
like my-app and my-db Pods in the following example:
INTRODUCTION TO KUBERNETES 5
3) Kube-proxy
So, the third process that is responsible for forwarding requests from Services to
Pods is actually Kube-proxy, that also must be installed on every Node.
INTRODUCTION TO KUBERNETES 6
Control Plane Nodes - 4 processes
- - - - X
● Or when we add another server, how does it get added to the cluster to
become a new Worker Node and get Pods and containers created on it?
1) API server
2) Scheduler
3) Controller Manager
4) etcd
INTRODUCTION TO KUBERNETES 7
1) API server
This means that with API Server, you have a single entry point into the cluster.
INTRODUCTION TO KUBERNETES 8
2) Scheduler
INTRODUCTION TO KUBERNETES 9
3) Controller Manager
The next component is the Controller Manager, which is another crucial Control
Plane process. Think about what happens when Pods die on any Node. There must
be a way to detect that Pods died and then reschedule those Pods as
soon as possible.
4) etcd
And the reason why the etcd store is the cluster brain is, because all the other
processes, like Scheduler, Controller manager, Kubelet, work based on the data in
etcd as well as communicate with each other through etcd store.
Note that Etcd can also be hosted and managed outside the cluster.
INTRODUCTION TO KUBERNETES 10
For example: ❓❓
● How does the Scheduler know what resources are available on each Worker
Node?
● How does the Controller Manager know that the cluster state changed or that
a pod died or that Kubelet restarted new Pods upon the request of a
Scheduler?
● When you make a query to the API server about the cluster health or the state
of your application, where does the API server get all this information from?
INTRODUCTION TO KUBERNETES 11
Example cluster setup
- - - - X
Important Control Plane processes
INTRODUCTION TO KUBERNETES 12
Also to note here, the hardware resources of Control Plane and Node
servers actually differ. Control Plane processes are more important, but
they actually have less load of work so they need less resources, like
CPU RAM and storage. Whereas, the Worker Nodes do the actual job of
running the Pods with containers inside. Therefore they need more
resources.
You can actually add new Control Plane or Worker nodes to the existing cluster
pretty easily.
That's it. This way you can infinitely increase the power and resources of your
Kubernetes cluster as your application complexity and it's resource demand
increases. 😎
INTRODUCTION TO KUBERNETES 13
Where to go from here?
- - - - X
🚀
On my Youtube channel Techworld with Nana you
can find many free videos about Kubernetes, Docker and
different DevOps technologies.
INTRODUCTION TO KUBERNETES 14
TWN Learning Resources
https://www.youtube.com/@TechWorldwithNana
TWN Learning Resources
For people:
who want to become a Kubernetes Administrator
who want to pass the CKA exam successfully
who need to set up and maintain a K8s cluster at
work
https://www.techworld-with-nana.com/kubernetes-administrator-cka
DevOps Bootcamp
A 6-month program to kickstart your career as a DevOps
engineer. The whole bootcamp was created with the focus of
making you job-ready and able to do the DevOps tasks at work
https://www.techworld-with-nana.com/devops-bootcamp
DevSecOps Bootcamp
Integrate Security in every part of the DevOps process and
advanced Kubernetes security
https://www.techworld-with-nana.com/devsecops-bootcamp
Last Learning Tip :)
Regardless of which resources you use to learn, be sure to
follow this roadmap step by step
1st:
Understand the WHY
2nd:
Immediately put it into practice