Kubernetes represents a powerful container orchestration platform designed to automate the deployment, scaling, and management of containerized applications. This article explores the fundamental architecture and essential concepts that form the backbone of Kubernetes clusters.
Kubernetes Architecture Overview
The Kubernetes architecture consists of a control plane (master) that manages worker nodes where applications run. The overall structure can be visualized as a hierarchical system with centralized management components coordinating distributed execution units.
1.1 Control Plane Components (Master)
The master node serves as the central management entity responsible for orchestrating the entire cluster. Its key components include:
API Server (kube-apiserver): This component serves as the central management entity exposing the Kubernetes API. It handles all REST operations and serves as the primary entry point for all cluster communications. Every operation—creating, modifying, or deleting resources—flows through this server.
etcd: A distributed key-value store providing consistent and highly-available data storage for all cluster state information. This backend storage system maintains the entire cluster configuration and must be properly backed up to ensure disaster recovery capabilities.
Scheduler (kube-scheduler): This component monitors the cluster for newly created pods without assigned nodes and selects optimal nodes for running them. The scheduler considers resource requirements, hardware constraints, and affinity specifications when making placement decisions.
Controller Manager (kube-controller-manager): Runs controller processes that handle routine cluster operations in the background. Although each controller operates as a separate logical process, they compile into a single binary for simplicity. These controllers include the node controller (handles node failures), replication controller (maintains correct pod replica counts), endpoints controller (manages service-to-pod mappings), and service account controllers (handles namespace authentication).
Cloud Controller Manager: Introduced in version 1.6, this component enables integration with cloud provider APIs. It runs cloud-specific control loops and can be disabled using the --cloud-provider flag. Functions include node management (cloud provider verification), routing configuration, load balancer management, and volume operations for cloud storage.
1.2 Node Components (Worker)
Nodes are worker machines that run containerized applications. Each node contains the following components:
kubelet: An agent running on each node that ensures containers execute within their assigned pods. It receives pod specifications and manages container lifecycle, health monitoring, and resource reporting to the control plane.
kube-proxy: Maintains network rules on nodes to enable service communication. This network proxy implements Kubernetes service abstraction by managing TCP/UDP forwarding rules and enabling service load balancing across pod replicas.
Container Runtime: The underlying software responsible for running containers. Kubernetes supports multiple runtime options including Docker, containerd, cri-o, and any CRI-compliant implementation.
1.3 Cluster Add-ons
Add-ons extend Kubernetes functionality through specialized pods and services:
DNS Service: Provides cluster-wide DNS resolution for service discovery, enabling pods to locate other services using human-readable names.
Web UI (Dashboard): A web-based interface enabling cluster management and application monitoring from a graphical console.
Monitoring: Tools like Container Resource Monitoring provide dashboards for tracking application performance, resource utilization, and cluster health.
Logging: Cluster-level logging aggregates container logs for analysis and troubleshooting across the entire cluster.
1.2 Core Kubernetes Concepts
1.2.1 Pods
Pods represent the smallest deployable units in Kubernetes, containing one or more containers that share network and storage resources. Each pod receives a unique IP address, enabling direct communication between pods across the cluster through overlay networking solutions.
Kubernetes supports two pod types: standard pods stored in etcd and static pods residing on specific node filesystems. When containers within a pod fail, kubelet automatically restarts them. If a node becomes unavailable, Kubernetes reschedules its pods to healthy nodes.
apiVersion: v1
kind: Pod
metadata:
name: web-server-pod
labels:
environment: production
tier: frontend
spec:
containers:
- name: nginx-container
image: nginx:latest
ports:
- containerPort: 8080
resources:
limits:
memory: "128Mi"
cpu: "500m"
1.2.2 Services
Services provide stable network endpoints for pods, abstracting away the dynamic nature of pod IP addresses. Since pods can be created and destroyed frequently, services ensure consistent access to application backends regardless of pod turnover.
A service defines a logical set of pods and a policy for accessing them, typically through label selectors. This abstraction allows frontend applications to connect to backend services without tracking individual pod instances.
apiVersion: v1
kind: Service
metadata:
name: backend-api-service
spec:
type: ClusterIP
selector:
app: backend
role: api
ports:
- name: http
protocol: TCP
port: 8080
targetPort: 3000
1.2.3 Volumes
Unlike Docker volumes, Kubernetes volumes exist at the pod level and persist across container restarts within that pod. Multiple containers within a pod can share access to the same volume, enabling data persistence and inter-container communication.
Kubernetes supports numerous volume types including cloud storage solutions (awsElasticBlockStore, azureDisk, gcePersistentDisk), network filesystems (nfs, glusterfs, cephfs), local storage options (hostPath, local), specialized systems (portworxVolume, quobyte, scaleIO), and configuration-focused types (configMap, secret, downwardAPI).
Local volumes provide node-specific storage with Kubernetes-aware scheduling, distinguishing them from hostPath by enabling automatic pod placement based on storage availability and constraints.
1.2.4 Labels and Selectors
Labels are key-value pairs attached to Kubernetes objects for organizational purposes. Label selectors enable filtering and grouping of resources based on these identifiers, providing a flexible mechanism for resource management and service coordination.
This labeling system enables sophisticated cluster management, allowing operators to organize workloads, define dependencies, and implement traffic routing policies efficiently.
1.2.5 Replication Controllers (RC)
Replication Controllers ensure the specified number of pod replicas remain running at all times. When pods exceed the desired count, the controller termintaes extras; when fewer exist, it creates new ones to match the expectation.
Common scenarios include scaling operations, rolling updates (gradually replacing pods with new versions while maintaining availability), and multi-version tracking during transitions. The controller continuously monitors the cluster state and reconciles differences automatically.
1.2.6 Replica Sets (RS)
Replica Sets represent the next generation of replication management, offering enhanced selector capabilities. While supporting equality-based selectors like their predecessors, they additionally support set-based selectors for more complex filtering criteria.
Replica Sets typically serve as building blocks for higher-level Deployment objects rather than being managed directly.
1.2.7 Deployments
Deployments provide declarative updates for pods and Replica Sets, allowing users to define desired states while the system reconciles actual conditions accordingly. This abstraction handles rollout, rollback, and scaling operations seamlessly.
Key capabilities include creating Replica Sets, monitoring deployment progress, updating pod templates for rolling releases, rolling back to previous versions, pausing and resuming deployments, and scaling application instances. Deployments track progression states, eliminating uncertainty about application availability during updates.
1.2.8 StatefulSets
StatefulSets manage stateful applications requiring persistent identities and stable storage. They provide guaranteed pod ordering during deployment and scaling operations, ensuring dependencies resolve correctly before subsequent pods initialize.
Distinguishing characteristics include stable network identifiers (consistent across rescheduling), persistent storage volumes (surviving pod termination), and ordered deployment/scaling (strict sequence enforcement from index 0 through N-1). These properties make StatefulSets ideal for databases, message queues, and other distributed systems requiring data consistency.
1.2.9 DaemonSets
DaemonSets ensure specific pods run on every node (or selected nodes) in the cluster. When new nodes join, the system automatically deploys matching pods; when nodes depart, those pods get garbage collected.
Typical applications include log aggregation daemons (fluentd, logstash), monitoring agents (Prometheus exporters, collectd), storage daemons (glusterd, ceph), and cluster services (kube-proxy, DNS). This pattern guarantees system-level services operate consistently across the infrastructure.
1.2.10 Jobs
Jobs create pods for batch processing scenarios where tasks run to completion rather than running indefinitely. They ensure specified task completions succeed, handling parallel execution and tracking completion status.
Job types include non-parallel jobs executing sequentially, parallel jobs with fixed completion counts requiring a specific number of successful terminations, and work queue jobs processing items from a shared queue across multiple workers.