Skip to content
❯ blogs.mnijhum

← all posts

Get familiar with Kubernetes Architecture

In the world of Kubernetes, a cluster is a collection of nodes or servers using a shared network to communicate between each other.

Md. Raufur Rahman · · 3 min read

Kubernetes Architecture

Cluster

In the world of Kubernetes, a cluster is a collection of nodes or servers using a shared network to communicate between each other.

Node

A physical or virtual machine with a given role.

  • Control-plane (Master Node): Makes most of the necessary decisions and acts as the brain of the entire cluster. It can be a single node or a group node in large projects.

  • Worker Node: Responsible for running workloads. These are usually controlled by the Master node and carry out various tasks according to the master node’s instructions.

Master Node Components

The Master node in a Kubernetes cluster consists of five components:

  1. kube-api-server:

    • Acts as the entrance to the Kubernetes control plane.
    • Responsible for validating and processing requests delivered using client libraries like the kubectl program.
  2. etcd:

    • A distributed key-value store.
    • Stores configuration data and information about the state of the cluster.
  3. kube-controller-manager:

    • Responsible for controlling the state of the cluster.
    • Ensures that requests made to the cluster are fulfilled.
    • A single process containing all the controller processes.
  4. kube-scheduler:

    • Assigns tasks to a certain node considering available resources and task requirements.
    • Ensures none of the nodes in the cluster is overloaded.
  5. cloud-controller-manager:

    • In a real-world cloud environment, this component binds the cluster with the cloud provider’s API.
    • Isolates components interacting with the cloud platform from those interacting with the cluster.

Node Components

  1. kubelet:

    • Acts as the gateway between the control plane and each node in a cluster.
    • Interacts with the etcd store to keep state information updated.
  2. kube-proxy:

    • Runs on each node and maintains network rules.
    • Any network request reaching a service inside the cluster passes through this service.
  3. Controller Runtime:

    • Kubernetes runs applications in containers, so every node needs a container runtime like Docker.

Kubernetes Objects

  1. Pod:

    • Smallest deployable unit in the cluster.
    • Can contain one or more tightly coupled containers that share network and storage resources.
  2. ReplicaSet:

    • Ensures a specified number of pod replicas are running at all times.
    • Maintains the desired state by creating or deleting pods as needed.
  3. Deployment:

    • Manages updates to ReplicaSets and provides necessary updates to applications.
    • Can roll back changes as necessary.
  4. Service:

    • An abstract way to expose an application running on a set of pods as a network service.

Example YAML Configuration

apiVersion: v1
kind: Pod
metadata:
  name: nginx-pod
spec:
  containers:
    - name: nginx-container
      image: nginx:latest

Command to Apply Configuration

kubectl apply -f <name.yaml>

Apply Command Workflow:

  1. kubectl sends the YAML configuration to the kube-api-server.
  2. kube-api-server receives, validates, and processes the request, storing it in etcd as part of the desired state.
  3. kube-scheduler observes the new desired state and makes scheduling decisions, identifying a node with available resources.
  4. kube-api-server contacts the kubelet of the chosen node, providing necessary commands for creating the pod.
  5. kubelet interacts with the container runtime (e.g., Docker) to start the container according to the pod’s configuration.
  6. kubelet keeps state information updated in etcd.
  7. kube-proxy on the node sets up network rules to allow communication to and from the pod.

Was this useful? A like tells me what to write more of.

15 reads

Comments (1)

  1. Arafin Ahmed

    Previously, I had a confusion about the how proxy pass through the cluster. After reading this blog, I got a clear idea about the network flow.

Protected by reCAPTCHA. Google's Privacy Policy and Terms apply.