Chapter 2. Kuberenets(K8s) Architecture

Shivani Singh
DevOps DeepDive
Published in
3 min readJun 18, 2020

Hello Everyone!

Let’s dig into the architecture of kubernetes(k8s) by understand its each component and respective functionality.
Below is the simplest pictorial view of a Kubernetes cluster consisting one master and one worker node components and communication between these.

MASTER NODE ARCHITECTURE:

As you can see, Master node consists of components like :
Api-server, Control Management , Scheduler and ETCD.

API requests(from command line (kubectl)/ GUI), Scheduler , Control Manager , all talks to API-Server and API-Server talks to Etcd.
Lets’ see each component in detail for master node.

  1. API-Server: It interacts with API using a tool called kubectl.
    Exposes APIs for almost every operation.

Kubectl is the command line utility to interact with Kubernetes API and its written in GoLang.
In a nutshell , to talk to kubernetes API for issuing any command ,API-server is responsible.

2. Scheduler: Schedule Pods across multiple nodes. Which node fits for the hardware requirements of the pod is been judged by scheduler.

Scheduler is a component on the master that watches the newly created Pods that have no node assigned , and selects a node for them to tun on as per the requirements of the Pod.

Scheduler gets the info for hardware configuration from configuration file and schedule the Pods on nodes accordingly.

3. Control Manager: This is a component on the master that runs controllers.
Logically , each controller is a seperate process , but to reduce complexity, they are all combined into a single binary and run in a single process.
Kube-controller-manager:
Runs controllers responsible to act
a. when a node become unavailable to ensure Pod counts are as expected.
b. To create endpoints
c. Service accounts and API-access tokens .

Controller Manager consists of following controllers:
1. Node controller(Notice and responds when a node is down).
2.Replication Controller(maintains the correct number of replication of Pods).
3.Endpoints Controller(Populates the endpoint objects i.e., joins services and pods).
4. Service account and token Controller(Creates default accounts and API access token for new namespaces).

Cloud Control Manager:
This controller is responsible to interact with underlying infrastructure of a cloud provider when node become unavailable.
To manage storage volumes when provided by a cloud service , and to manage load-balancing and routing.

In a nutshell, Controller run watch-loops continuously to compare cluster’s desired state to its current state. In case of any mismatch , corrective action in taken in the cluster until its current state matches the desired state.

4. ETCD: This is the Key-Value store for the cluster.
when an object is created , that object’s state is stored here,

ETCD acts as a reference for the cluster state . If the cluster differs from what is indicated here, the cluster is changed to match.
It majorly consists of sensitive data like password, keys ,tokens and configuration, in order to secure your cluster you may need to encrypt the data inside ETCD.

WORKER NODE ARCHITECTURE

1.Kube-Proxy: This runs on the node to provide network connectivity for services on the nodes that connect to the Pods.In addition , it also load balace traffic between application components.

2.Kubelet: This is the primary node agent that runs on each node. It uses a PodSpec and a provided object that describe a Pod, to monitor the Pods on its node.
The kubectl checks the state of its Pods and ensures that they match the spec.
In addition , it also manages the containers on nodes and talk to the API-Server.

3. Container RunTime: A container provider/manager. for example .,Docker.

Descriptive pictorial View of K8s architecture!

See You in next Chapter!
Happy Learning!
Shivani S.

--

--

Shivani Singh
DevOps DeepDive

DevOps Engineer, Passionate for new tools and Technology!