Kubernetes Architecture

ashwini purwatashwini purwat
3 min read

Kubernetes is a powerful container orchestration platform that automates the deployment, scaling, and management of containerized applications. Its architecture is designed to manage large-scale containerized applications efficiently. Here’s a breakdown of Kubernetes architecture:

Lightbox

Cluster Architecture

A Kubernetes cluster consists of two main components: the Control Plane and the Nodes.

Control Plane

The Control Plane manages the overall state of the Kubernetes cluster. It makes global decisions about the cluster (e.g., scheduling) and detects and responds to cluster events (e.g., starting up new pods when a deployment's replicas field is unsatisfied).

Components of the Control Plane:

API Server (kube-apiserver):

  • The API server is the entry point for all REST commands used to control the cluster. It exposes the Kubernetes API and serves as the gateway for all interactions with the cluster.

  • It handles requests from clients (e.g., kubectl commands) and other components (e.g., controllers).

Scheduler (kube-scheduler):

  • The scheduler is responsible for scheduling pods onto nodes based on resource requirements, constraints, and affinity rules.

  • It ensures that pods are placed on appropriate nodes to meet their resource and scheduling needs.

Controller Manager (kube-controller-manager):

  • The controller manager runs controllers that are responsible for ensuring the desired state of the cluster. Examples include the Replication Controller and the Deployment Controller.

  • It handles routine tasks such as scaling pods, handling node failures, and managing resources.

etcd:

  • etcd is a distributed key-value store used to persist the state and configuration of the cluster.

  • It stores all cluster data, including configurations, state, and metadata, and serves as the source of truth for the cluster.

Cloud Controller Manager (optional):

  • The cloud controller manager interacts with the cloud provider's API to manage resources specific to a cloud environment (e.g., load balancers, volumes).

  • It is used in cloud environments to ensure that the Kubernetes cluster integrates seamlessly with cloud provider services.

Nodes

Nodes are the worker machines in a Kubernetes cluster where containers run. Each node can be a physical or virtual machine.

Components of a Node:

  1. Kubelet:

    • The kubelet is an agent that runs on each node and ensures that containers are running in pods as expected.

    • It communicates with the API server to get the desired state of the pods and manages container lifecycle.

  2. Kube-Proxy:

    • The kube-proxy maintains network rules on nodes. It handles network routing and load balancing for services within the cluster.

    • It enables communication between services and provides network abstractions such as ClusterIP, NodePort, and LoadBalancer.

  3. Container Runtime:

    • The container runtime is responsible for running containers on a node. Examples include Docker, containerd, and CRI-O.

    • It pulls container images from repositories, runs containers, and handles container lifecycle.

  4. Pods:

    • Pods are the smallest deployable units in Kubernetes, consisting of one or more containers that share storage and network resources.

    • Pods are managed by higher-level controllers (e.g., Deployments, ReplicaSets) and can be scheduled and scaled as needed.

0
Subscribe to my newsletter

Read articles from ashwini purwat directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

ashwini purwat
ashwini purwat