KAHIBARO Bookshelves
Discord Login Register

3.2. Kubernetes architecture

High-level view of Kubernetes architecture

Kubernetes is built as a distributed control system that manages containers across many machines. At a high level, the architecture is split into two main logical parts:

  • Control plane: the “brain” of the cluster that makes global decisions (scheduling, scaling, health) and exposes the Kubernetes API.
  • Worker nodes: the “muscle” of the cluster that actually runs your application containers.

All interaction with the cluster—whether from users, automation, or internal components—goes through the Kubernetes API. Everything else in the system reacts to the desired state stored in this API.

You’ll later see the components of the control plane and worker nodes in their own chapters; here we focus on how they fit together and why the architecture looks the way it does.

Logical vs. physical architecture

It helps to separate two perspectives:

  • Logical architecture – how components interact:
    • API server at the center
    • Persistent cluster state in a key–value store
    • Controllers that reconcile state
    • Scheduler that assigns work to nodes
    • Kubelet and runtimes on nodes that run workloads
  • Physical architecture – what runs where:
    • One or more control plane nodes running control plane components
    • Many worker nodes running pods/containers
    • Optional bastion/jump hosts, load balancers, and external services (like storage, identity providers, etc.)

In small demo clusters, control plane and worker roles may live on the same machine. In production, they are usually separated and the control plane is hardened.

The Kubernetes API as the core

At the center of the architecture is the Kubernetes API server and its data store:

  • All cluster state is represented as API objects (Pods, Deployments, Nodes, ConfigMaps, etc.).
  • Users and tools interact by sending declarative specifications to the API server.
  • Other components watch the API for changes and act accordingly.

Conceptually:

  1. A user (or CI system) sends a desired state, like “run 3 replicas of this application,” to the API.
  2. The API server validates, stores, and exposes this state.
  3. Controllers and the scheduler watch this state and make decisions (where to run pods, how to restart them, etc.).
  4. Node agents (kubelets) ensure the containers actually run as described.

This “API-centric” architecture is why Kubernetes is easily extensible and why tools like kubectl, CI/CD systems, and operators can all integrate in a consistent way.

Desired state and reconciliation loop

Kubernetes architecture is built around a control loop pattern:

  • Users describe the desired state in API objects.
  • Current state (what’s actually running) is constantly observed.
  • Controllers try to make current state match desired state.

Examples of reconciliation loops:

  • A Deployment controller ensures the requested number of pod replicas exist and are updated using the specified strategy.
  • A Node controller observes node health; if a node stops reporting, it marks the node as NotReady and may trigger rescheduling.

Key points:

  • Controllers do not run one-time scripts; they are long-running loops:
    $$\text{loop: observe} \rightarrow \text{compare} \rightarrow \text{act}$$
  • This architecture makes the system self-healing and resilient to transient failures.
  • Controllers sit in the control plane; kubelets and runtimes exist on the nodes, but all coordinate via the API.

Control plane vs. data plane

Kubernetes uses a common architectural split:

  • Control plane (control logic):
    • Makes decisions: scheduling, scaling, replacement, admission.
    • Stores cluster configuration and policy.
    • Exposes the API and responds to queries/updates.
  • Data plane (workload execution):
    • Runs the user pods and containers.
    • Forwards network traffic to/from pods.
    • Mounts and uses storage.

Design consequences:

  • The control plane is relatively light on CPU usage but critical for availability. It’s typically run on dedicated, protected nodes.
  • Scaling workloads mostly means adding more worker nodes; the control plane can often remain unchanged for a while.
  • If worker nodes fail, workloads are rescheduled; if the control plane fails entirely, the cluster cannot make new decisions, even if existing pods keep running for some time.

Cluster topology and components at a glance

A typical production cluster looks roughly like this:

  • Multiple control plane nodes
    • Each runs the control plane components, with one acting as current leader for certain roles.
    • An external or internal load balancer sits in front of them, presenting a single API endpoint.
  • Many worker nodes
    • Each node runs:
      • A node agent (kubelet)
      • A container runtime (e.g., CRI-O, containerd)
      • The Kubernetes networking component (kube-proxy) and any CNI plugins
  • External dependencies
    • A storage system (block/file/object) for persistent volumes
    • A Certificate Authority or external identity providers
    • Optionally, external load balancers or DNS for exposing services

The exact implementation details are deferred to the “Control plane components” and “Worker node components” chapters, but the architectural point is: every piece either provides or consumes the API, stores cluster state, or runs containers.

Networking and service abstraction in the architecture

Kubernetes’ architecture assumes a specific networking model:

  • Every pod gets an IP address within a flat, routable cluster network.
  • Pods can generally talk to each other without NAT (subject to network policy).
  • Nodes can talk to pods and the API server; the API server can reach the nodes.

Within this architecture, Kubernetes provides:

  • Services as stable virtual endpoints for a set of pods.
  • Load distribution at L4 (and in some setups L7) via service proxies.

Architecturally, this means:

  • A component on each node implements service traffic handling (commonly kube-proxy, possibly using iptables or eBPF).
  • Additional ingress components may run as pods to provide external HTTP/HTTPS access.

While detailed networking is covered elsewhere, the important architectural takeaway is that networking is implemented as pluggable components attached to the nodes, not hard-coded into the core control plane.

Storage and state in the architecture

From an architectural standpoint, there are two kinds of state:

  1. Cluster configuration and metadata state
    • Stored in a distributed key–value store behind the API server.
    • Contains API objects and configuration.
    • Critical to the control plane; typically kept on control plane nodes.
  2. Application data (persistent volumes)
    • Provided by external storage systems through volume plugins and storage classes.
    • Mounted into pods via the node’s kubelet and container runtime.
    • Architecturally separate from the control plane store, to avoid mixing application data and cluster metadata.

This separation allows you to back up/restore the control plane independently of bulk application data and plug in different storage solutions without changing the core architecture.

Extensibility in the Kubernetes architecture

The architecture is designed to be extensible without modifying the core:

  • Custom Resource Definitions (CRDs) allow new kinds of API objects to be defined.
  • Controllers and Operators implement new reconciliation loops for these resources.
  • Admission webhooks and mutating webhooks plug into the request flow at the API server level.
  • CNI (Container Network Interface) and CSI (Container Storage Interface) define pluggable points for network and storage providers.

Architecturally:

  • Everything still talks to the same API server.
  • New capabilities are usually added by running more controllers and components as pods on the cluster, rather than changing the core binaries.
  • This keeps the core architecture stable, while the behavior of the platform can be customized per environment.

Multi-cluster and higher-level control

While Kubernetes describes the architecture of a single cluster, the same patterns scale outward:

  • Multiple clusters can be:
    • Managed centrally through higher-level controllers.
    • Connected to form hybrid or multi-cloud platforms.
  • The basic pattern remains the same:
    • Each cluster has its own control plane and data plane.
    • External systems orchestrate multiple clusters by talking to each cluster’s API.

For this course, focus on understanding one cluster’s architecture well; later topics such as hybrid workflows and managed OpenShift will build directly on these principles.

Views: 0

Comments

Please login to add a comment.

Don't have an account? Register now!

Where to Move

Move chapter:

  • ☰ 1. Course Overview
    • ☰ 1.1. What is OpenShift
      • ☰ 1.2. Why OpenShift is used in modern IT and cloud environments
        • ☰ 1.3. OpenShift vs Kubernetes
          • ☰ 1.4. Typical OpenShift use cases
            • ☰ 1.5. Structure and goals of the course
            • ☰ 2. Containers and Cloud-Native Fundamentals
              • ☰ 2.1. What is a container
                • ☰ 2.2. Containers vs virtual machines
                  • ☰ 2.3. Introduction to Docker and container images
                    • ☰ 2.4. Container registries
                      • ☰ 2.5. Basics of cloud-native applications
                      • ☰ 3. Kubernetes Fundamentals
                        • ☰ 3.1. What is Kubernetes
                          • ☰ 3.2. Kubernetes architecture
                            • ☰ 3.3. Control plane components
                              • ☰ 3.4. Worker node components
                                • ☰ 3.5. Kubernetes objects and resources
                                  • ☰ 3.6. Declarative configuration model
                                  • ☰ 4. OpenShift Architecture
                                    • ☰ 4.1. Overview of OpenShift architecture
                                      • ☰ 4.2. Control plane in OpenShift
                                        • ☰ 4.3. Nodes and machine roles
                                          • ☰ 4.4. OpenShift Operators
                                            • ☰ 4.5. OpenShift networking model
                                              • ☰ 4.6. OpenShift storage model
                                              • ☰ 5. OpenShift Installation and Deployment Models
                                                • ☰ 5.1. OpenShift deployment options
                                                  • ☰ 5.2. Installer-Provisioned Infrastructure
                                                    • ☰ 5.3. User-Provisioned Infrastructure
                                                      • ☰ 5.4. Managed OpenShift services
                                                        • ☰ 5.5. Single-node OpenShift
                                                          • ☰ 5.6. Cluster lifecycle management
                                                          • ☰ 6. Accessing and Using OpenShift
                                                            • ☰ 6.1. OpenShift web console
                                                              • ☰ 6.2. OpenShift CLI (oc)
                                                                • ☰ 6.3. Authentication and authorization
                                                                  • ☰ 6.4. Projects and namespaces
                                                                    • ☰ 6.5. Resource quotas and limits
                                                                    • ☰ 7. Building and Deploying Applications
                                                                      • ☰ 7.1. Application deployment concepts
                                                                        • ☰ 7.2. Source-to-Image (S2I)
                                                                          • ☰ 7.3. Container-based deployments
                                                                            • ☰ 7.4. DeploymentConfigs and Deployments
                                                                              • ☰ 7.5. Rolling updates and rollbacks
                                                                              • ☰ 8. Networking in OpenShift
                                                                                • ☰ 8.1. Services and service discovery
                                                                                  • ☰ 8.2. Routes and ingress
                                                                                    • ☰ 8.3. Network policies
                                                                                      • ☰ 8.4. Load balancing
                                                                                        • ☰ 8.5. External access to applications
                                                                                        • ☰ 9. Storage in OpenShift
                                                                                          • ☰ 9.1. Persistent storage concepts
                                                                                            • ☰ 9.2. Persistent Volumes
                                                                                              • ☰ 9.3. Persistent Volume Claims
                                                                                                • ☰ 9.4. StorageClasses
                                                                                                  • ☰ 9.5. Dynamic provisioning
                                                                                                    • ☰ 9.6. Stateful applications
                                                                                                    • ☰ 10. Configuration and Secrets Management
                                                                                                      • ☰ 10.1. ConfigMaps
                                                                                                        • ☰ 10.2. Secrets
                                                                                                          • ☰ 10.3. Environment variables
                                                                                                            • ☰ 10.4. Managing sensitive data
                                                                                                              • ☰ 10.5. Best practices for configuration
                                                                                                              • ☰ 11. Scaling and High Availability
                                                                                                                • ☰ 11.1. Horizontal pod autoscaling
                                                                                                                  • ☰ 11.2. Vertical scaling
                                                                                                                    • ☰ 11.3. Self-healing and pod restarts
                                                                                                                      • ☰ 11.4. High availability concepts
                                                                                                                        • ☰ 11.5. Multi-zone and multi-region clusters
                                                                                                                        • ☰ 12. Monitoring, Logging, and Observability
                                                                                                                          • ☰ 12.1. Built-in monitoring stack
                                                                                                                            • ☰ 12.2. Metrics and alerts
                                                                                                                              • ☰ 12.3. Logging architecture
                                                                                                                                • ☰ 12.4. Distributed tracing
                                                                                                                                  • ☰ 12.5. Troubleshooting applications
                                                                                                                                  • ☰ 13. Security in OpenShift
                                                                                                                                    • ☰ 13.1. Security model overview
                                                                                                                                      • ☰ 13.2. Role-Based Access Control
                                                                                                                                        • ☰ 13.3. Security Context Constraints
                                                                                                                                          • ☰ 13.4. Image security and scanning
                                                                                                                                            • ☰ 13.5. Network security
                                                                                                                                              • ☰ 13.6. Compliance and auditing
                                                                                                                                              • ☰ 14. CI/CD and DevOps with OpenShift
                                                                                                                                                • ☰ 14.1. DevOps concepts
                                                                                                                                                  • ☰ 14.2. CI/CD pipelines overview
                                                                                                                                                    • ☰ 14.3. OpenShift Pipelines (Tekton)
                                                                                                                                                      • ☰ 14.4. GitOps with Argo CD
                                                                                                                                                        • ☰ 14.5. Integrating OpenShift with external CI tools
                                                                                                                                                        • ☰ 15. Operators and Platform Services
                                                                                                                                                          • ☰ 15.1. What are Operators
                                                                                                                                                            • ☰ 15.2. Operator Lifecycle Manager
                                                                                                                                                              • ☰ 15.3. Installing and managing Operators
                                                                                                                                                                • ☰ 15.4. Common platform Operators
                                                                                                                                                                  • ☰ 15.5. Custom Operators
                                                                                                                                                                  • ☰ 16. Upgrades, Maintenance, and Operations
                                                                                                                                                                    • ☰ 16.1. OpenShift upgrade process
                                                                                                                                                                      • ☰ 16.2. Backup and restore
                                                                                                                                                                        • ☰ 16.3. Node maintenance
                                                                                                                                                                          • ☰ 16.4. Cluster troubleshooting
                                                                                                                                                                            • ☰ 16.5. Capacity planning
                                                                                                                                                                            • ☰ 17. OpenShift on HPC and Specialized Workloads
                                                                                                                                                                              • ☰ 17.1. Running batch workloads on OpenShift
                                                                                                                                                                                • ☰ 17.2. OpenShift and GPUs
                                                                                                                                                                                  • ☰ 17.3. MPI and parallel workloads in containers
                                                                                                                                                                                    • ☰ 17.4. Hybrid HPC and cloud workflows
                                                                                                                                                                                    • ☰ 18. OpenShift in Practice
                                                                                                                                                                                      • ☰ 18.1. Typical OpenShift workflows
                                                                                                                                                                                        • ☰ 18.2. Development to production lifecycle
                                                                                                                                                                                          • ☰ 18.3. Case studies from industry
                                                                                                                                                                                            • ☰ 18.4. Common pitfalls and best practices
                                                                                                                                                                                            • ☰ 19. Future Directions and Ecosystem
                                                                                                                                                                                              • ☰ 19.1. Kubernetes ecosystem overview
                                                                                                                                                                                                • ☰ 19.2. OpenShift roadmap
                                                                                                                                                                                                  • ☰ 19.3. Serverless and event-driven workloads
                                                                                                                                                                                                    • ☰ 19.4. AI and data platforms on OpenShift
                                                                                                                                                                                                    • ☰ 20. Final Project and Hands-On Exercises
                                                                                                                                                                                                      • ☰ 20.1. Deploying a containerized application
                                                                                                                                                                                                        • ☰ 20.2. Implementing CI/CD with OpenShift
                                                                                                                                                                                                          • ☰ 20.3. Securing and scaling an application
                                                                                                                                                                                                            • ☰ 20.4. Monitoring and troubleshooting report