CoachnestCoachnest
For OrganizationsSign InGet Started
Back to course

DevOps Essentials: Docker to Kubernetes

…
—
Contents
1

Container Fundamentals

Reading12mFree
2

Docker in Practice — Compose & Networking

Video35m
3

Docker Assessment

Quiz15m
4

Lesson 10

Reading

Kubernetes Architecture & Core Concepts

Reading20m
6

Deploying a Full-Stack App on Kubernetes

Video40m
7

DevOps Final Assessment

Quiz20m
←→navigate lessons
Chapter 2 of 2·Kubernetes
Lesson 5 of 7Reading20 min

Kubernetes Architecture & Core Concepts

#Kubernetes Architecture & Core Concepts¶

Kubernetes (K8s) is the industry-standard container orchestration platform. It automates deployment, scaling, and management of containerised applications.

Why Kubernetes?¶

Running one container on one server is easy. Running thousands of containers across hundreds of servers is not. Kubernetes solves:

  • Scheduling — which containers run on which nodes?
  • Self-healing — restart failed containers automatically
  • Scaling — add more instances when load increases
  • Rolling updates — deploy new versions with zero downtime
  • Service discovery — containers find each other by name, not IP

The Control Plane¶

┌─────────────────────────────────────────────────┐ │ Kubernetes Cluster │ │ │ │ ┌─────────────────────────────────────────┐ │ │ │ Control Plane │ │ │ │ ┌──────────┐ ┌───────┐ ┌──────────┐ │ │ │ │ │ API Server│ │ etcd │ │ Scheduler│ │ │ │ │ └──────────┘ └───────┘ └──────────┘ │ │ │ └─────────────────────────────────────────┘ │ │ │ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ │ │ Node 1 │ │ Node 2 │ │ Node 3 │ │ │ │ ┌──────┐ │ │ ┌──────┐ │ │ ┌──────┐ │ │ │ │ │ Pod │ │ │ │ Pod │ │ │ │ Pod │ │ │ │ │ └──────┘ │ │ └──────┘ │ │ └──────┘ │ │ │ └──────────┘ └──────────┘ └──────────┘ │ └─────────────────────────────────────────────────┘

Core Objects¶

Pod¶

The smallest deployable unit — one or more containers that share networking and storage.

yaml
10 lines
1apiVersion: v1
2kind: Pod
3metadata:
4  name: my-app
5spec:
6  containers:
7  - name: app
8    image: my-app:1.0
9    ports:
10    - containerPort: 3000

Deployment¶

Manages a set of identical Pods. Handles rolling updates and rollbacks.

yaml
26 lines
1apiVersion: apps/v1
2kind: Deployment
3metadata:
4  name: my-app
5spec:
6  replicas: 3              # Run 3 Pods
7  selector:
8    matchLabels:
9      app: my-app
10  template:
11    metadata:
12      labels:
13        app: my-app
14    spec:
15      containers:
16      - name: app
17        image: my-app:1.0
18        ports:
19        - containerPort: 3000
20        resources:
21          requests:
22            cpu: "100m"
23            memory: "128Mi"
24          limits:
25            cpu: "250m"
26            memory: "256Mi"

Service¶

Provides a stable network endpoint to reach a set of Pods.

yaml
11 lines
1apiVersion: v1
2kind: Service
3metadata:
4  name: my-app-svc
5spec:
6  selector:
7    app: my-app
8  ports:
9  - port: 80
10    targetPort: 3000
11  type: ClusterIP    # or LoadBalancer for external access

Essential kubectl Commands¶

bash
8 lines
1kubectl get pods                     # List pods
2kubectl get deployments              # List deployments
3kubectl describe pod my-app          # Detailed info
4kubectl logs my-app-abc123           # Pod logs
5kubectl exec -it my-app-abc123 -- sh # Shell into pod
6kubectl apply -f deployment.yaml     # Apply config
7kubectl scale deploy/my-app --replicas=5  # Scale up
8kubectl rollout undo deploy/my-app   # Rollback

Previous

Lesson 10

Next

Deploying a Full-Stack App on Kubernetes

Use ← → arrow keys to navigate between lessons