language: en kae3g ← back to index
(unlisted) — This essay is not shown on the main index but remains accessible via direct link

kae3g 9511: Kubernetes - Container Orchestration at Scale

Phase 1: Foundations & Philosophy | Week 2 | Reading Time: 12 minutes

What You'll Learn

Prerequisites

What Is Kubernetes?

Kubernetes (k8s) is a container orchestration platform.

What that means:

Born at Google (2014), now industry standard for cloud deployments.

Think of it as: Unix process management (Essay 9570), but for distributed systems at cloud scale!

Why Kubernetes Exists

The problem: Modern apps are distributed systems.

Example web app:

Without orchestration:

With Kubernetes:

Core Concepts

1. Pods (Smallest Unit)

apiVersion: v1
kind: Pod
metadata:
  name: my-app
spec:
  containers:
  - name: web
    image: nginx:latest
    ports:
    - containerPort: 80

Pod = one or more containers sharing:

Typically: One container per pod.

2. Deployments (Manage Replicas)

apiVersion: apps/v1
kind: Deployment
metadata:
  name: web-app
spec:
  replicas: 3  # Run 3 copies!
  selector:
    matchLabels:
      app: web
  template:
    metadata:
      labels:
        app: web
    spec:
      containers:
      - name: nginx
        image: nginx:1.21

Deployment ensures:

This is declarative (like Nix!): You declare "I want 3", Kubernetes ensures 3 exist.

3. Services (Stable Networking)

apiVersion: v1
kind: Service
metadata:
  name: web-service
spec:
  selector:
    app: web
  ports:
  - port: 80
    targetPort: 80
  type: LoadBalancer

Problem: Pods have dynamic IPs (come and go).

Solution: Service provides stable endpoint:

Kubernetes Architecture (Simplified)

Control Plane (Brain)
├── API Server (central interface)
├── Scheduler (assigns pods to nodes)
├── Controller Manager (reconciliation)
└── etcd (state storage)
        │
    ────┴────────────────
    │         │         │
  Node 1   Node 2   Node 3
  (Pods)   (Pods)   (Pods)

Control Plane: Makes decisions
Nodes: Run workloads

Unix Philosophy in Kubernetes

Kubernetes embodies Unix principles (Essay 9510):

1. Do One Thing Well

Each component specialized:

Not monolithic. Each part replaceable.

2. Composition

# Compose simple resources
Pod + Service + Deployment = Complete app

Like Unix pipes: Simple tools → complex workflows.

3. Declarative

Unix:

ls | grep ".txt" | wc -l  # "Count .txt files" (what, not how)

Kubernetes:

replicas: 3  # "I want 3" (what, not how)

Kubernetes figures out HOW (like Nix!).

Running Kubernetes Locally

Option 1: Minikube

# Install (macOS)
brew install minikube

# Start
minikube start

# Deploy nginx
kubectl create deployment nginx --image=nginx
kubectl expose deployment nginx --port=80 --type=NodePort

# Access
minikube service nginx

Pros: Full k8s API
Cons: Resource-heavy (VM)

Option 2: K3s (Lightweight!)

# Install (100MB binary)
curl -sfL https://get.k3s.io | sh -

# Use
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
kubectl get nodes

# Deploy
kubectl create deployment nginx --image=nginx

Pros: Fast, lightweight, production-ready
Cons: Slightly different from full k8s

When to Use Kubernetes

Use Kubernetes when:

Examples:

Don't use Kubernetes when:

Rule of thumb: Start simple. Add Kubernetes when you outgrow simpler tools.

Try This

Exercise: Run K3s Locally

# Install kubectl
brew install kubectl

# Deploy app
kubectl create deployment hello --image=rancher/hello-world

# Expose
kubectl expose deployment hello --port=80 --type=NodePort

# Get service port
kubectl get services

# Visit http://localhost:<PORT>

Observe:

Summary

Kubernetes is:

Core concepts:

Unix Philosophy in Kubernetes:

When to use:

When NOT to use:

Modern applications:

In the Valley:

Plant lens: "Kubernetes is large-scale agricultural coordination (managing thousands of crop rows). Simple deployments are home gardens (tend directly). Choose the right scale for your needs."

Next: Continue to functional programming (Essay 9520), or explore the deep dives!

Optional Deep Dives (can skip or read later):

Navigation:
← Previous: 9510 (unix philosophy primer) | Phase 1 Index | Next: 9512 (unix philosophy deep dive)

Optional Deep Dives: 9512 (Unix Deep) | 9513 (Sovereignty Deep)

Metadata:

Copyright © 2025 kae3g | Dual-licensed under Apache-2.0 / MIT
Competitive technology in service of clarity and beauty


← back to index