Lets directly jump into the Architecture with out
wasting any time. Kubernetes work as on Master and worker node architecture. In
total Kubernetes has 7 components out of which 4 belongs to Master node and 3
belongs to worker node as described and shown below:
Master Node components:
1. API Server
2. Controller Manager
3. ETCD
4. Scheduler
Worker Node components:
1. Kube-proxy
2. Kubelet
3. Runtime
Let’s discuss these components one by one –
MASTER NODE – As the name suggests it is the master for the
cluster and entry point for all the administrative tasks which is responsible
for managing the Kubernetes cluster.
There can be one or more than one Master inside a cluster
for fault tolerance & high availability. Let’s check each component which are
responsible to make a node Master.
-
API SERVER
This is the front end for the
Kubernetes control plane. All API calls are sent to this server and server send
commands to the other services.
No component talks to each other
directly , API server is responsible for all the communication.
-
Etcd
This is the Key Value store for the
cluster. When an object is created, that objects state is stored here.
Etcd acts as the reference for the
cluster state. If the cluster differs from what is indicated in Etcd, cluster
would change to match the declared state. For e.g 2 Pods supposed to run with
certain image or task if any pods gets deleted it would automatically create
one more to match the state.
-
Scheduler
When a new pod is created scheduler determines
which node should run it & this decision is based on many factors including
hardware, workload’s, affinity etc.
-
Controller Manager
It operates the cluster controllers –
·
Node
Controller – Responsible for noticing and responding when nodes go down.
·
Replication
Controller – responsible for maintaining the correct number of pods for every
replication controller object in the system
·
Endpoints
Controller – Populates the endpoint objects i.e. joins services and pods
·
Service
Accounts & Token Controllers – creates default accounts and API access
tokens for new namespaces
Worker Node (minions) – It is a physical server or VM which runs
the applications using Pods which is controlled by the Master node.
“Pods are the smallest working unit of Kubernetes just
like container of Docker” or you can say Kubernetes doesn’t run containers
instead it wraps one or more containers into a higher-level structure called
POD. Pods are used as the unit of replication in Kubernetes.
Lets check the components of Worker Nodes –
Kube-Proxy:
-
This runs on the nodes and provides
network connectivity for services on the nodes that connect to the pods.
-
It serves as a network proxy and a
load balancer for a service on a single worker node and manages the network
routing for TCP and UDP packets.
-
Kube-proxy runs on each node to deal
with individual host sub-netting and ensure that the services are available to
external parties.
Kubelet:
-
It is an agent which communicates
with the Master node and executes on nodes or the worker nodes. It gets the Pod
specifications through the API server and executes the containers associated
with the Pod and ensures that the containers described in those Pod are running
and healthy.
Container
Runtime:
- This is the container manager. It
can be any container runtime that is compliant with the Open Container
initiative such as Docker or to run and manage a container’s lifecycle, we need
a container runtime on the worker node.
-
Sometimes, Docker is also
referred to as a container runtime, but to be precise, Docker is a platform
which uses containers as a container runtime.