A Algo3DVerse
03 — DevOps
DevOps — Lesson 3 of 6

Kubernetes &
Orchestration

Kubernetes schedules pods across nodes, scales on demand, and heals failures automatically. Kill a node — watch the pods reschedule themselves in 3D.

When you have hundreds of containers across dozens of services, you need an orchestrator. Kubernetes automates deployment, scaling, and self-healing — you declare what you want and K8s makes it so. No more manual server management.

Cluster Orchestration in 3D

Control Plane schedules pods onto worker nodes. Press Scale Up to add pods. Press Kill a Node to watch self-healing reschedule them automatically.

drag — scroll to zoom

Code example

A Deployment YAML and the kubectl commands to manage it.

KUBERNETES DEPLOYMENT
# deployment.yaml — describe desired state; K8s makes it real
apiVersion: apps/v1
kind: Deployment
metadata:
  name: api-deployment
spec:
  replicas: 3              # always run 3 pods
  selector:
    matchLabels:
      app: api
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1           # spin up 1 new before killing old
      maxUnavailable: 0     # never drop below 3 healthy pods
  template:
    metadata:
      labels:
        app: api
    spec:
      containers:
        - name: api
          image: myapp:1.4.2
          ports:
            - containerPort: 3000
          resources:
            requests: { cpu: "100m", memory: "128Mi" }
            limits:   { cpu: "500m", memory: "512Mi" }
          readinessProbe:
            httpGet: { path: /health, port: 3000 }
            initialDelaySeconds: 5
            periodSeconds: 10
# Apply the deployment (create or update)
kubectl apply -f deployment.yaml

# Watch pods come up in real time
kubectl get pods -w

# Scale manually (overrides YAML until next apply)
kubectl scale deployment api-deployment --replicas=5

# Rolling update to new image version
kubectl set image deployment/api-deployment \
  api=myapp:1.4.3

# Watch rollout progress
kubectl rollout status deployment/api-deployment

# Roll back if the new version is broken
kubectl rollout undo deployment/api-deployment

# See logs from a running pod
kubectl logs -f deployment/api-deployment

# Shell into a pod for debugging
kubectl exec -it \
  $(kubectl get pod -l app=api -o jsonpath='{.items[0].metadata.name}') \
  -- /bin/sh

Key concepts

🎛

Control Plane

scheduler — etcd — API server

The brain of the cluster. The API server is your interface (kubectl talks to it), the scheduler places pods on nodes, and etcd stores all cluster state as key-value pairs.

☸

Pod

container — ephemeral — atomic

The smallest schedulable unit. Pods are ephemeral — they can be killed and replaced at any time. Never store persistent state in a pod's filesystem. Use PersistentVolumes or external databases.

♻

ReplicaSet

desired state — self-heal — N copies

Declares that N copies of a pod must always be running. If a pod crashes, the ReplicaSet controller creates a replacement. Deployments wrap ReplicaSets to add rolling update logic.

🌐

Service

stable IP — load balance — DNS

Gives a stable virtual IP and DNS name to a dynamic set of pods. kube-proxy routes traffic to healthy pods. Types: ClusterIP (internal), NodePort (external), LoadBalancer (cloud LB).

→ Docker DevOps — Algo3DVerse Infrastructure as Code ?
Press ? to begin the narration walkthrough.
0 / 9