Kubernetes

Kubernetes is an open-source container orchestration platform that automates deploying, scaling, and managing containers across a cluster.

Kubernetes (shortened to K8s) is a container orchestration platform that treats a cluster of machines as a single pool of compute. You declare the desired state - "run 5 replicas of this container, expose it on port 80" - and Kubernetes continuously works to achieve and maintain that state, handling scheduling, restarts, rolling updates, and traffic routing automatically.

Running Docker containers in production at any meaningful scale requires answering questions Docker alone does not answer: which container runs on which node, what happens when one crashes, how do you roll out an update without dropping traffic. Kubernetes answers all of these.

Why it matters in Engineering: Kubernetes became the standard infrastructure layer for running microservices at scale. It handles service discovery, load balancing, secret management, configuration management, and horizontal auto-scaling out of the box. Teams that once needed dedicated platform work to deploy safely can encode that logic in version-controlled YAML. The tradeoff is steep operational complexity. Kubernetes has a significant learning curve, and running it yourself requires real platform engineering investment. Managed options - AWS EKS, Google GKE, Azure AKS - reduce that burden considerably. For small teams or simple applications, it is often overkill.

Core Concepts

Pod
The smallest deployable unit in Kubernetes. A pod wraps one or more containers that share a network namespace and storage volumes. Pods are ephemeral - treat them as disposable.

Deployment
Declares how many pod replicas to run and how to update them. Manages rolling updates and rollbacks. The primary abstraction for running stateless workloads.

Service
A stable network endpoint that routes traffic to the current set of healthy pods, regardless of which pods are running at any given moment.

Namespace
Partitions cluster resources between teams or environments (dev, staging, prod) within the same physical cluster. Useful for access control and resource quotas.

Helm
A package manager for Kubernetes. Helm Charts bundle all the Kubernetes manifests for an application into a versioned, reusable, configurable package.

Subscribe to Sahil's Playbook

Clear thinking on product, engineering, and building at scale. No noise. One email when there's something worth sharing.
[email protected]
Subscribe
Mastodon