Kubernetes
Kubernetes is an open-source platform for automating deployment, scaling, and management of containerized applications across clusters of machines.
Kubernetes is an open-source container orchestration platform that automates the deployment, scaling, networking, and management of containerized applications across clusters of machines. Originally developed by Google and released in 2014, Kubernetes builds on more than a decade of experience running production workloads at scale, and it is now maintained by the Cloud Native Computing Foundation (CNCF). It provides a declarative model in which operators describe the desired state of an application, and a set of control loops continuously work to make the actual state of the cluster match that desired state.
Architecture
Kubernetes follows a control-plane and worker-node architecture. The control plane makes global decisions about the cluster, while worker nodes run the actual application workloads inside containers.
Control Plane Components
The control plane consists of several cooperating processes:
- The API server exposes the Kubernetes API and acts as the front end for the control plane, validating and processing all requests.
- The etcd data store holds all cluster state as a consistent, distributed key-value store.
- The scheduler assigns newly created Pods to nodes based on resource requirements, constraints, and affinity rules.
- The controller manager runs controller processes that watch the state of the cluster and drive it toward the desired state.
- The cloud controller manager integrates with underlying cloud provider APIs when Kubernetes runs on a cloud platform.
Node Components
Every worker node runs a minimal set of components needed to host Pods:
- The kubelet is an agent that ensures containers described in Pod specifications are running and healthy.
- The container runtime is the software responsible for actually running containers, such as containerd or CRI-O.
- Kube-proxy maintains network rules on nodes, enabling communication to and from Pods from inside and outside the cluster.
Core Objects
Kubernetes exposes a set of API objects that represent the state of the cluster.
Pods
A Pod is the smallest deployable unit in Kubernetes. It represents one or more tightly coupled containers that share storage, network namespace, and a specification for how to run.
Workload Controllers
Higher-level controllers manage Pods on behalf of users:
- Deployments manage stateless replica sets and support rolling updates and rollbacks.
- StatefulSets manage stateful applications that require stable network identities and persistent storage.
- DaemonSets ensure that a copy of a Pod runs on every node, or a designated subset of nodes.
- Jobs and CronJobs manage batch or scheduled workloads that run to completion.
Services and Networking
A Service defines a stable network endpoint for a set of Pods, abstracting away the ephemeral nature of individual Pod IP addresses. Ingress resources manage external HTTP and HTTPS access to services within a cluster, typically including routing rules and TLS termination.
Configuration and Storage
ConfigMaps and Secrets externalize configuration data and sensitive values from container images. PersistentVolumes and PersistentVolumeClaims provide an abstraction for durable storage that can outlive the lifecycle of individual Pods.
Reconciliation and the Control Loop Model
Kubernetes operates on a continuous reconciliation model. Each controller watches the current state of a resource type through the API server and compares it to the desired state stored in etcd. When a discrepancy exists, the controller takes action to converge the two.
This loop repeats indefinitely, which is what allows Kubernetes to self-heal: if a node fails or a container crashes, the relevant controller detects the deviation and schedules replacement Pods automatically.
Scheduling and Scaling
Scheduling
The scheduler evaluates every unscheduled Pod against the pool of available nodes, filtering out nodes that do not meet resource or constraint requirements, then scoring the remaining candidates to select the best fit.
Horizontal and Vertical Scaling
The Horizontal Pod Autoscaler adjusts the number of Pod replicas based on observed metrics such as CPU utilization or custom metrics. The Vertical Pod Autoscaler instead adjusts the resource requests and limits of individual Pods. Cluster Autoscaler extends this further by adding or removing nodes from the underlying infrastructure based on scheduling pressure.
Networking Model
Kubernetes networking is built on a flat model in which every Pod receives its own IP address and can communicate with every other Pod without network address translation. This model is implemented by a Container Network Interface (CNI) plugin, and different plugins implement it using different underlying technologies such as overlay networks, BGP routing, or native cloud provider networking.
Extensibility
Kubernetes is designed to be extended rather than modified. Custom Resource Definitions (CRDs) allow users to define new resource types that behave like native Kubernetes objects. The Operator pattern builds on CRDs by pairing them with custom controllers that encode operational knowledge for managing complex, stateful applications. Admission webhooks and the API aggregation layer provide additional points for extending cluster behavior without changing Kubernetes core code.
Ecosystem and Adoption
Kubernetes has become the de facto standard for container orchestration and forms the foundation of most major cloud providers' managed container platforms. Its ecosystem includes package managers such as Helm, service meshes such as Istio and Linkerd, observability tooling such as Prometheus and Grafana, and a large body of CNCF-graduated projects that extend its capabilities across security, networking, and storage.
Content in this section
- 1 Kubernetes Foundations
- 2 Kubernetes Cluster Architecture
- 3 Kubernetes Control Plane
- 4 Kubernetes Nodes and Runtime
- 5 Kubernetes API and Object Model
- 6 Kubernetes Manifests and Declarative State
- 7 Kubernetes Metadata Labels and Selectors
- 8 Kubernetes Pods and Containers
- 9 Kubernetes Pod Lifecycle and Health
- 10 Kubernetes Workload Controllers
- 11 Kubernetes Deployment Management
- 12 Kubernetes Stateful Workloads
- 13 Kubernetes Batch Workloads
- 14 Kubernetes Daemon Workloads
- 15 Kubernetes Scheduling and Placement
- 16 Kubernetes Resource Management
- 17 Kubernetes Namespaces and Organization
- 18 Kubernetes Services and Discovery
- 19 Kubernetes Networking
- 20 Kubernetes Ingress and Gateway Routing
- 21 Kubernetes Storage and Volumes
- 22 Kubernetes Configuration and Secrets
- 23 Kubernetes Security Identity and Access
- 24 Kubernetes Admission and Policy
- 25 Kubernetes Autoscaling
- 26 Kubernetes Observability
- 27 Kubernetes Extensibility and Operators
- 28 Kubernetes Packaging and Customization Basics
- 29 Kubernetes Reliability and Availability Basics
- 30 Kubernetes Best Practices