Kubernetes
Container Orchestration
Cloud Computing
DevOps
IT Infrastructure

Kubernetes whitepaper

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

Introduction

Kubernetes (often abbreviated as K8s) has become a fundamental part of the cloud-native ecosystem. As an open-source container orchestration platform, it automates the deployment, scaling, and management of containerized applications. Originating from Google's internal Borg system, Kubernetes was open-sourced in 2014 and has since been maintained by the Cloud Native Computing Foundation (CNCF).

Core Concepts

Containers and Pods

Kubernetes operates at a higher abstraction level than individual containers. The basic scheduling unit is a pod, which can encapsulate one or more containers that share storage and networking resources. All containers within a pod can communicate with each other via `localhost`, making it an ideal setup for closely integrated multi-container applications.

Cluster Architecture

A Kubernetes system is comprised of several key components:

  • Master node: It manages the cluster and consists of various components like `API Server`, `etcd`, `Scheduler`, and `Controller Manager`.
  • Worker nodes: These nodes execute the tasks as instructed by the master. Each worker node runs a `kubelet`, `kube-proxy`, and a container runtime (like Docker).

API Server

The Kubernetes API server is a crucial component that acts as the frontend for the Kubernetes control plane. It exposes the Kubernetes API and is essentially the core of Kubernetes’ management platform.

etcd

`etcd` is a consistent and highly-available key-value store used as Kubernetes’ backing store for all cluster data. Every change made to the cluster state is stored in `etcd`.

Scheduler and Controller Manager

  • Scheduler: It watches for newly created pods without assigned nodes and selects a node for them to run on.
  • Controller Manager: It runs controllers, which watch the state of the cluster and make or request changes where needed. Examples include the `ReplicaSet Controller` and `Node Controller`.

Key Features

Self-Healing

Kubernetes automatically monitors and resolves issues with nodes, ensuring the desired state is achieved. If a node fails, Kubernetes automatically reschedules pods onto healthy nodes.

Service Discovery and Load Balancing

Kubernetes assigns a single DNS name for each set of pods and can balance the load across them. Services without using external libraries handle discovery itself.

Automated Rollouts and Rollbacks

Kubernetes manages updates for your application. You describe the desired state, and Kubernetes changes the actual state to the desired state at a controlled rate.

Secret and Configuration Management

Manage sensitive information such as passwords, OAuth tokens, and SSH keys, without rebuilding your container images, keeping secrets.

Examples

Example of Pod Definition

Here’s a simple YAML configuration for a pod running an NGINX server:

  • name: nginx
    • containerPort: 80
      • name: nginx
        • containerPort: 80
  • Complexity: Kubernetes' extensive features come with complexity. Proper understanding and training are necessary.
  • Networking: While Kubernetes offers an extensible networking model, configuration can be non-trivial, but projects like `Istio` simplify service mesh integration.
  • Security: As with any orchestration platform, security is paramount. It's crucial to adopt best practices in security policies and audit logs regularly.

Related reading
Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

All Rights Reserved.