Understanding Kubernetes (K8S) Architecture and Core Components
This article provides a comprehensive overview of Kubernetes, detailing its cloud‑native architecture, the roles of Master and Node components, key services such as API Server, etcd, Controller Manager, Scheduler, as well as node‑level elements like Kubelet, container runtimes, and Kube‑Proxy, while also offering practical code examples and resource links.
Kubernetes (K8S) is an open‑source container orchestration platform originally developed by Google and now maintained by the Cloud Native Computing Foundation (CNCF). It automates deployment, scaling, and management of containerized applications, enabling developers to efficiently build and run distributed systems.
Architecture Overview
K8S follows a master‑node model similar to Google’s Borg project. The cluster consists of a Master control plane and multiple Worker (Node) machines. The Master handles global management and scheduling, while Nodes run the actual containers and manage resources.
Master Node Components
The Master includes several critical components:
API Server : Exposes the cluster’s RESTful API, serving as the entry point for all interactions. It validates, authorizes, and persists requests to etcd.
etcd : A distributed key‑value store that holds the entire cluster state, providing consistency via the Raft consensus algorithm and high availability through multiple replicas.
Controller Manager : Runs various controllers (ReplicaSet, Deployment, Node, Service, etc.) that continuously reconcile the actual state with the desired state.
Scheduler : Assigns newly created Pods to suitable Nodes based on resource requirements, policies, and constraints.
Example of the API Server request flow:
Client --> [kube-apiserver] --> [etcd]Example of etcd interaction:
[kube-apiserver] <--> [etcd Cluster]Example of Scheduler communication:
[kube-scheduler] <--> [kube-apiserver] --> [Node]Node (Worker) Components
Each Node runs the following essential services:
Kubelet : Ensures that Pods defined via the API Server are started and remain healthy on the Node.
Container Runtime : The underlying software (e.g., Docker) that actually launches and manages containers.
Kube‑proxy : Maintains network rules for Service load‑balancing and service discovery, supporting iptables, IPVS, etc.
Sample Kubelet configuration snippet:
containers:
- name: kube-proxy
image: k8s.gcr.io/kube-proxy:v1.21.0
command:
- kube-proxy
- --config=/etc/kubernetes/kube-proxy-config.yaml
volumeMounts:
- mountPath: /etc/kubernetes
name: kubeconfig
readOnly: true
volumes:
- name: kubeconfig
hostPath:
path: /etc/kubernetesK8S Workflow
The typical lifecycle includes cluster initialization (installing Master and Nodes), application deployment via kubectl or Helm, scheduling of Pods by the Scheduler, execution of Pods by Kubelet, network routing by Kube‑proxy, and continuous monitoring and automation performed by the Controller Manager, often visualized with tools like Prometheus and Grafana.
Applications
Kubernetes is widely used for containerized application management, micro‑service architectures, CI/CD pipelines, edge computing, and more, making it a cornerstone of modern cloud‑native development.
Additional Resources
The author also offers a comprehensive 300,000‑word architecture collection and a Java interview Q&A compilation, accessible via the provided links for readers interested in deeper study.
Mike Chen's Internet Architecture
Over ten years of BAT architecture experience, shared generously!
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.