Kubernetes: A Quick Guide to Its Architecture

Thu Oct 26, 2023

Overview

Kubernetes, often abbreviated as K8s, is an open-source container orchestration platform originally developed by Google and later donated to the CNCF.       

The "8" in "K8s" represents the eight letters between the "K" and the "s" in "Kubernetes."

What Problem Does K8s Solve?

Kubernetes (K8s) solves several problems related to deploying and managing containerized applications in modern software development:

  1. Container Orchestration: It simplifies the orchestration of containers, allowing developers to efficiently manage and scale their applications.
  2. Scaling: K8s automates the scaling of applications to handle varying workloads, ensuring consistent performance.
  3. High Availability: It provides tools to maintain application availability by distributing containers across multiple servers and recovering from failures.
  4. Resource Management: K8s optimizes resource utilization, reducing waste and saving costs.
  5. Service Discovery: It streamlines the process of connecting and discovering services in complex, microservices-based applications.
  6. Rolling Updates: K8s enables seamless updates and rollbacks of applications, reducing downtime during maintenance.
  7. Self-healing: It automatically detects and replaces failing containers, improving application reliability.
  8. Declarative Configuration: K8s ensures that applications run as intended, reducing configuration errors and drift.
  9. Multi-Cloud Support: It allows for the consistent management of applications across different cloud providers and on-premises infrastructure.

Kubernetes Cluster Architecture

Kubernetes architecture is a complex but powerful system for managing containerized applications. By understanding its components and how they work together, you can harness the full potential of Kubernetes for deploying, managing, and scaling your applications.

   

Kubernetes runs your workload by placing containers into Pods to run on Nodes

A node may be a virtual or physical machine, depending on the cluster.

In a Kubernetes (K8s) cluster, there are two types of nodes: 

  1. Control-plane nodes (also known as master nodes )  
  2. worker nodes (also known as minion nodes).                                         

Control Plane Node (Master Nodes):     

The control plane of a Kubernetes cluster is responsible for managing and orchestrating the entire cluster.

They serve as the brain of the operation and handle administrative tasks. The key components on the Control Plane Node include:

  1. API Server: This is the central control point for all interactions with the Kubernetes cluster. It exposes the Kubernetes API and acts as the front end for the control plane, All communication, including creating, updating, or deleting resources, goes through the API server.
  2. Etcd: Etcd is a distributed key-value store that serves as the cluster's database. It stores all the configuration data, such as the desired state of the system. Etcd is crucial for maintaining the cluster's consistency and reliability.
  3. Controller Manager: The controller manager is responsible for regulating various aspects of the cluster. It continuously monitors the state of the cluster and takes corrective actions to ensure that the actual state matches the desired state.
  4. Scheduler: The scheduler is incharge of assigning workloads, which are defined as Pods, to worker nodes. It considers factors like resource requirements, constraints, and load distribution when making scheduling decisions.

Worker Nodes (Minion Nodes):

Worker nodes, or minion nodes, are where the actual application workloads run.

They execute containers and provide essential services for the applications.

Each worker  node typically consists of the following components:

  1. Kubelet: The kubelet is an agent running on each worker node. It is responsible for ensuring that containers are running within Pods. It communicates with the Control Plane node's API server to receive instructions and starts or stops containers accordingly.
  2. Kube Proxy: Kube Proxy is responsible for maintaining network rules on nodes. It manages network communication between Pods and services within the cluster, ensuring that traffic is correctly routed.
  3. Container Runtime: This component is responsible for running containers. Kubernetes supports multiple container runtimes, with Docker being one of the most commonly used options. Other runtimes like containerd, CRI-O, and others can also be used.


How Control Plane and Worker Nodes Collaborate


The Control Plane Node and worker nodes work together to ensure the proper functioning of the Kubernetes cluster. Here's a simplified overview of their collaboration:

  1. A user or application sends a request to the Kubernetes cluster via the API server on a Control Plane Node.
  2. The API server processes the request and stores the desired state of the cluster in etcd.
  3. The controller manager continuously monitors the cluster state and takes actions to align the actual state with the desired state.
  4. When a new Pod needs to be created, the scheduler on the Control Plane Node selects an appropriate worker node based on resource requirements and constraints.
  5. The selected worker node's Kubelet receives instructions from the Control Plane Node to create the Pod and its associated containers.
  6. The Kube Proxy on the worker node manages network traffic, ensuring that the Pod can communicate with other Pods and services within the cluster.
  7. The container runtime on the worker node runs the containers inside the Pod.

This collaboration ensures that applications are deployed, managed, and scaled effectively within a Kubernetes cluster, with the Control Plane Node handling control and orchestration while the worker nodes execute the actual workloads.

Conclusion

As the demand for cloud-native technologies continues to rise, Kubernetes remains a fundamental solution for container orchestration. 

We hope this guide has illuminated Kubernetes' architecture and its significance in modern software development. 

If you have any questions or would like to explore specific topics further, please don't hesitate to ask. Thank you for joining us on this exploration of Kubernetes!

Sampath Siva Kumar Boddeti
AWS & Terraform Certified