Kubernetes
lastmod 2026-08-23created 2015-12-19127 edits
The de facto standard of Container Orchestration.
Docker plays a pivotal role in a collection of powerful, innovative tools and technologies for bringing containerized software development to the open source community. Kubernetes, which Google unveiled last June, is an open-source container management tool used to accelerate development and simplify operations.
Google has long used containers in its internal operations. At DockerCon in the summer of 2014, Google open-sourced Kubernetes, which was developed to meet the needs of the explosively growing Docker ecosystem. Through collaboration with other organizations and projects, including Red Hat and CoreOS, the Kubernetes project maintainers have grown Kubernetes into the No. 1 downloaded project on Docker Hub. The Kubernetes team plans to expand the project and grow the community to help software developers save the time they spend managing infrastructure and use it to build apps.
Categories
- Container Orchestration
- Cloud Native Computing Foundation (CNCF; Linux Foundation)
- Kubernetes:Install
- Kubernetes:ContainerRuntimes
- Kubernetes:Basic
- Kubernetes:ConfigMap
- Kubernetes:Pod
- Kubernetes:ReplicaSet
- Kubernetes:Volume
- Kubernetes:Secret
- Kubernetes:Service
- Kubernetes:ServiceAccount
- Kubernetes:PersistentVolume (Kubernetes:SharedStorage)
- Kubernetes:HorizontalPodAutoscaler (HPA; Autoscaling)
- Kubernetes:CustomResourceDefinition (CRD; CRDs)
- Kubernetes:PersistentVolumeClaim (PVC)
- Kubernetes:ServiceLoadBalancer (svclb; SLB)
- Kubernetes:StorageClass
- Kubernetes:NetworkPolicies
- Kubernetes:API (kube-apiserver)
- Kubernetes:VirtualBox
- Kubernetes:Troubleshooting
- DevOps:Kubernetes - Building a DevOps server on Kubernetes.
- kubectl - Command-line utility
- kubeadm - Command to bootstrap the cluster
- kubelet - A component that runs on all machines in the cluster and does things like starting pods and containers
- kind (Kubernetes IN Docker)
- Persistent Volume (PV)
- Persistent Volume Claim (PVC)
Core Components
A Kubernetes cluster consists of a control plane and one or more worker nodes. Here's a brief overview of the main components:
Control Plane Components
Manage the overall state of the cluster:
- kube-apiserver - The core component server that exposes the Kubernetes HTTP API.
- etcd - Consistent and highly-available key value store for all API server data.
- kube-scheduler - Looks for Pods not yet bound to a node, and assigns each Pod to a suitable node.
- kube-controller-manager - Runs controllers to implement Kubernetes API behavior.
- cloud-controller-manager (optional) - Integrates with underlying cloud provider(s).
Node Components
Run on every node, maintaining running pods and providing the Kubernetes runtime environment:
- kubelet - Ensures that Pods are running, including their containers.
- kube-proxy (optional) - Maintains network rules on nodes to implement Services.
- Container runtime - Software responsible for running containers. Read Container Runtimes to learn more.
Lightweight
- Lightweight Kubernetes (k3s; Rancher)
- microk8s (Canonical)
- minikube
- kind
- k3d - k8s installed in docker
- KubeSolo - Ultra-lightweight, single-node Kubernetes optimized for IoT and edge
- Rancher Kubernetes Engine (RKE)
- RKE2
Cloud Service
Container Network Interface (CNI)
- Ingress
- Flannel
- ACI
- Calico
- Canal
- Cilium
- CNI-Genie
- Contiv
- Multus
- NSX-T
- Nuage
- Romana
- Weave Net
Libraries
Block Storage
Object Storage
Configuration
certificate
Secret
Sidecar
Dashboard / Management
- Kubetail - Real-time Kubernetes logging dashboard
- KuView - Web-based real-time Kubernetes dashboard
- KDash - Fast and simple Kubernetes dashboard
- Kubeshark - API traffic viewer for Kubernetes
- Headlamp - Easy-to-use, extensible Kubernetes web UI
Services
- Porter - Open-source PaaS based on Korean: 쿠버네티스.
- Canine - Open-source platform that makes Kubernetes as easy as Heroku
ETC
- CDK for Kubernetes (cdk8s)
- kubespray - Cluster setup automation tool.
- Docker
- Docker Swarm
- k0s
- netshoot - A container that includes various tools needed for tracking down network problems.
- Talos Linux - Linux designed for K8s
- StackRox - Kubernetes security platform
- Lens - A program for managing Kubernetes clusters
- kubeflow - Kubeflow is a machine learning platform that automates the repetitive tasks across the entire pipeline of developing, training, and deploying machine learning models.
- Istio
- Carreta - Kubernetes dependency map generator
- KWOK - Kubernetes WithOut Kubelet
- Tilt - Managing development environments as code
- zeropod - Pods that scale down to zero
- Uncloud - A tool for deploying containerized apps across servers without the complexity of Kubernetes
- Virtual Kubelet
- Karpenter
- NVIDIA Container Toolkit
Why do we need Kubernetes?
In a production environment, you need to manage the containers that run your applications and make sure there is no downtime. For example, if a container goes down, another container needs to be started to minimize downtime.
What if this behavior could be handled by the system?
Having these problems managed by the system is the role of Kubernetes!
Features
According to the official Kubernetes website, it provides the following features.
- Service discovery and load balancing - Expose containers using a DNS name or their own IP address
- Storage orchestration - Automatically mount a storage system of your choice, such as local storage or public cloud providers
- Automated rollouts and rollbacks - Describe the desired state, and change the current state to the desired state at a configured rate
- Automatic bin packing - Provides the CPU and memory (RAM) each container needs
- Self-healing - Restarts failed containers and replaces containers
- Secret and configuration management - Store and manage sensitive information such as passwords, OAuth tokens, and SSH keys
Patterns
- Foundational patterns
- Health probe pattern
- Predictable demands pattern
- Automated placement pattern
- Structural patterns
- Init container pattern
- Sidecar pattern
- Behavioral patterns
- Batch job pattern
- Stateful service pattern
- Service discovery pattern
- Advanced patterns
- Controller pattern
- Operator pattern
Cordon vs Drain
- Cordon
- Excludes a specific node from the scheduler so that no pods are assigned to it. Pods already deployed on the node stay where they are.
- Drain
- Excludes a specific node from the scheduler so that no pods are assigned to it, and moves the pods already deployed there to other nodes. Useful when updating a node.
HTTP connection
See Kube-apiserver#HTTPS Endpoint.
Checklis for using Kubernetes in production
Running applications in production can be tricky. This post proposes an opinionated checklist for going to production with a web service (i.e. application exposing HTTP API) on Kubernetes.
This checklist was shaped by my own limited experience in Zalando, so please see it only as template for your own checklist adopted to your environment. Some items can be considered optional or aspirational, depending on context.
General
- Application's name, description, purpose, and owning team is clearly documented (e.g. in a central application registry or wiki)
- Application's criticality level was defined (e.g. "tier 1" if the app is highly critical for the business)
- Development team has sufficient knowledge/experience with the technology stack
- Responsible 24/7 on-call team is identified and informed
- Go-Live plan exists incl. steps for potential rollback
Application
- Application's code repository (git) has clear instructions on how to develop, how to configure, and how to contribute changes (important for emergency fixes)
- Code dependencies are pinned (i.e. hotfix changes do not accidentally pull in new libraries)
- All relevant code is instrumented with OpenTracing or OpenTelemetry
- OpenTracing/OpenTelemetry semantic conventions are followed (incl. additional company conventions)
- All outgoing HTTP calls have a defined timeout
- HTTP connection pools are configured with sane values according to expected traffic
- Thread pools and/or non-blocking async code is correctly implemented/configured
- Database connection pools are sized correctly
- Retries and retry policies (e.g. backoff with jitter) are implemented for dependent services
- Circuit breakers are implemented
- Fallbacks for circuit breakers are defined according to business requirements
- Load shedding / rate limiting mechanisms are implemented (could be part of provided infrastructure)
- Application metrics are exposed for collection (e.g. to be scraped by Prometheus)
- Application logs go to stdout/stderr
- Application logs follow good practices (e.g. structured logging, meaningful messages), log levels are clearly defined, and debug logging is disabled for production by default (with option to turn on)
- Application container crashes on fatal errors (i.e. it does not enter some unrecoverable state or deadlock)
- Application design/code was reviewed by a senior/principal engineer
Security & Compliance
- Application can run as unprivileged user (non-root)
- Application does not require a writable container filesystem (i.e. can be mounted read-only)
- HTTP requests are authenticated and authorized (e.g. using OAuth)
- Mechanisms to mitigate Denial Of Service (DOS) attacks are in place (e.g. ingress rate limiting, WAF)
- A security audit was conducted
- Automated vulnerability checks for code / dependencies are in place
- Processed data is understood, classified (e.g. PII), and documented
- Threat model was created and risks are documented
- Other applicable organizational rules and compliance standards are followed
CI/CD
- Automated code linting is run on every change
- Automated tests are part of the delivery pipeline
- No manual operations are needed for production deployments
- All relevant team members can deploy and rollback
- Production deployments have smoke tests and optionally automatic rollbacks
- Lead time from code commit to production is fast (e.g. 15 minutes or less including test runs)
Kubernetes
- Development team is trained in Kubernetes topics and knows relevant concepts
- Kubernetes manifests use the latest API version (e.g. apps/v1 for Deployment)
- Container runs as non-root and uses a read-only filesystem
- A proper Readiness Probe was defined, see blog post about Readiness/Liveness Probes
- No Liveness Probe is used, or there is a clear rationale to use a Liveness Probe, see blog post about Readiness/Liveness Probes
- Kubernetes deployment has at least two replicas
- A Pod Disruption Budget was defined (or is automatically created, e.g. by pdb-controller)
- Horizontal autoscaling (HPA) is configured if adequate
- Memory and CPU requests are set according to performance/load tests
- Memory limit equals memory requests (to avoid memory overcommit)
- CPU limits are not set or impact of CPU throttling is well understood
- Application is correctly configured for the container environment (e.g. JVM heap, single-threaded runtimes, runtimes not container-aware)
- Single application process runs per container
- Application can handle graceful shutdown and rolling updates without disruptions, see this blog post
- Pod Lifecycle Hook (e.g. "sleep 20" in preStop) is used if the application does not handle graceful termination
- All required Pod labels are set (e.g. Zalando uses "application", "component", "environment")
- Application is set up for high availability: pods are spread across failure domains (AZs, default behavior for cross-AZ clusters) and/or application is deployed to multiple clusters
- Kubernetes Service uses the right label selector for pods (e.g. not only matches the "application" label, but also "component" and "environment" for future extensibility)
- There are no anti-affinity rules defined, unless really required (pods are spread across failure domains by default)
- Optional: Tolerations are used as needed (e.g. to bind pods to a specific node pool)
See also this curated checklist of Kubernetes production best practices.
Monitoring
- Metrics for The Four Golden Signals are collected
- Application metrics are collected (e.g. via Prometheus scraping)
- Backing data store (e.g. PostgreSQL database) is monitored
- SLOs are defined
- Monitoring dashboards (e.g. Grafana) exist (could be automatically set up)
- Alerting rules are defined based on impact, not potential causes
Testing
- Breaking points were tested (system/chaos test)
- Load test was performed which reflects the expected traffic pattern
- Backup and restore of the data store (e.g. PostgreSQL database) was tested
24/7 On-Call
- All relevant 24/7 personnel is informed about the go-live (e.g. other teams, SREs, or other roles like incident commanders)
- 24/7 on-call team has sufficient knowledge about the application and business context
- 24/7 on-call team has necessary production access (e.g. kubectl, kube-web-view, application logs)
- 24/7 on-call team has expertise to troubleshoot production issues with the tech stack (e.g. JVM)
- 24/7 on-call team is trained and confident to perform standard operations (scale up, rollback, ..)
- Runbooks are defined for application-specific incident handling
- Runbooks for overload scenarios have pre-approved business decisions (e.g. what customer feature to disable to reduce load)
- Monitoring alerts to page the 24/7 on-call team are set up
- Automatic escalation rules are in place (e.g. page next level after 10 minutes without acknowledgement)
- Process for conducting postmortems and disseminating incident learnings exists
- Regular application/operational reviews are conducted (e.g. looking at SLO breaches)
Documentation
- Kubernetes Hardening Guidance from the US National Security Agency (NSA)
- https://media.defense.gov/2021/Aug/03/2002820425/-1/-1/1/CTR_KUBERNETES%20HARDENING%20GUIDANCE.PDF
-
CTR_KUBERNETES_HARDENING_GUIDANCE.PDF - Key points
- Scan containers and pods for vulnerabilities or misconfigurations
- Run containers and pods with the least privilege possible
- Use network separation to control the damage that can occur
- Use firewalls to limit unneeded network connectivity, and use encryption
- Use strong authentication and authorization to limit user and administrator access and restrict the attack surface.
- Use Log Auditing so administrators can monitor activity and be alerted to potentially malicious activity
- Periodically review all k8s settings and use Vulnerability scans to make sure risks are mitigated and security patches are applied
- [Translation] 10 easy mistakes to make in Kubernetes
- https://coffeewhale.com/kubernetes/mistake/2020/11/29/mistake-10/
Building a web server with k8s
- Building a web server with k8s - Part 1. install k3s with Calico - Oznote.io_-_k8s_web_server_1.pdf
- Building a web server with k8s - Part 2. setup nginx-ingress, ipvs, metalb - Oznote.io_-_k8s_web_server_2.pdf
- Building a web server with k8s - Part 3. deploy nextjs (with. bun.js) - Oznote.io_-_k8s_web_server_3.pdf
- Building a web server with k8s - Part 4. Applying https to nginx ingress (using cert-manager) - Oznote.io_-_k8s_web_server_4.pdf
- Building a web server with k8s - Part 5. Deploying and integrating MariaDB - Oznote.io_-_k8s_web_server_5.pdf
- Building a web server with k8s - Part 5-1. (Extra) Deploying and integrating PostgreSQL - Oznote.io_-_k8s_web_server_5-1.pdf
- Building a web server with k8s - Part 6. Setting up MiniO - Oznote.io_-_k8s_web_server_6.pdf
iptables in Kubernetes
See Iptables#iptables in Kubernetes for details.
Server Side Apply
- [Recommended] What is Server Side Apply in Kubernetes?
List of Container Orchestration
- Container Orchestration
- Marathon (Apache)
- Rancher (SUSE)
- Shipyard
- Kubernetes (Google)
- OpenShift (Red Hat)
- Swarm (Docker)
- Mesos (Apache)
- DEIS
- Nomad (HashiCorp)
- Tanzu (VMware)
- Singularity (HPC)
See also
- Cluster manager
- Docker
- Meshery - Open-source cloud native manager
- clopus-watcher - A Claude Code-style autonomous 24/7 on-call engineer - An AI-based monitoring tool aimed at automating incident response in Kubernetes environments
Favorite site
- kubernetes web site
- Kubernetes - ArchWiki
- A case study of build server virtualization using Docker + Kubernetes
- After reading Google's container management paper (Borg Paper, Kubernetes)
- Installing Kubernetes (Ubuntu 15.04)
- Container orchestration system, "Kubernetes"
- Slideshare: Introduce Google Kubernetes (ko)
- Slideshare: A case study of build server virtualization using Docker + Kubernetes
- [Recommended] CNCF Cloud Native Interactive Landscape - Kubernetes Ecosystem Landscape image
Documentation
How to install
See Kubernetes:Install#Favorite site for details.
Guide
- (Translation) 10 easy mistakes to make in Kubernetes
- [Recommended] A Kubernetes guide for Docker Swarm lovers - Kubernetes for people who know Docker Swarm
- [Recommended] How Kubernetes Pods work, revisited from Containers up
- [Recommended] (Translation) Running 2,500 Kubernetes nodes
- (Original) Scaling Kubernetes to 2,500 Nodes
Tutorials
- Kubernetes Guide - For beginners, from installation to deployment <Hands-on>
- kubectl for Docker Users | Kubernetes
Article
Videos
- Kubernetes official documentary - Parts 1 and 2, 55 minutes total
Online Tools
- kyaml2go - Kubernetes client-go code generator for resource YAMLs
- KUBERNETES INSTANCE CALCULATOR - A calculator that helps you easily find suitable instances for your Kubernetes cluster.
- Kubernetes Spec Explorer - Reference Guide and Documentation
- Easily browse the documentation for all Kubernetes resources/properties/types/examples
- Tree view with the schema, types, and descriptions of all resources
- Shows the change history (properties added/removed/modified) since version X
- Supports all versions since 1.25, including the newly released 1.32
References
-
Getting_Started_with_Kubernetes_-_What_is_Kubernetes.pdf ↩
- Amazon Elastic Kubernetes Service
- Apache Mesos
- Argo CD
- Canine
- Carreta
- CDK for Kubernetes
- Ceph
- Cert-manager
- Clopus-watcher
- Cloud Native Computing Foundation
- Cloudtype
- Cluster manager
- Continuous integration
- ContinuousIntegration:ImplementationGuide
- De facto
- DevOps:Kubernetes
- Docker
- Docker:Swarm
- FastAPI
- Fission
- Flannel
- Flux
- Git-sync
- GitLab
- GitLab CI
- GitLab:Kubernetes
- GlusterFS
- Headlamp
- Helm
- Iptables
- Karpenter
- Kind
- KServe
- Kube-apiserver
- Kubeadm
- Kubectl
- Kubectl:api-resources
- Kubectl:get
- Kubectl:port-forward
- Kubeflow
- Kubeflow Spark Operator
- Kubeflow:Architecture
- Kubeflow:Install
- Kubelet
- Kubernetes:Basic
- Kubernetes:ConfigMap
- Kubernetes:ContainerRuntimes
- Kubernetes:CustomResourceDefinition
- Kubernetes:HorizontalPodAutoscaler
- Kubernetes:Install
- Kubernetes:NetworkPolicies
- Kubernetes:PersistentVolume
- Kubernetes:PersistentVolumeClaim
- Kubernetes:Pod
- Kubernetes:Service
- Kubernetes:ServiceAccount
- Kubernetes:Troubleshooting
- Kubernetes:VirtualBox
- Kubeshark
- KubeSolo
and 52 more