Kubernetes Tutorial

Orchestrate containers — pods, deployments, services, and a scalable app.

1 min read 128 words Updated Mar 14, 2026

Kubernetes automates deployment, scaling, and recovery of containerized apps.

Core objects

Object Purpose
Pod one or more co-located containers
Deployment desired replicas + rollout strategy
Service stable network endpoint
ConfigMap configuration data

A deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: web
spec:
  replicas: 3
  selector:
    matchLabels: { app: web }
  template:
    metadata:
      labels: { app: web }
    spec:
      containers:
        - name: web
          image: myapp:1.0
          ports: [{ containerPort: 3000 }]

Expose it

apiVersion: v1
kind: Service
metadata:
  name: web
spec:
  selector: { app: web }
  ports: [{ port: 80, targetPort: 3000 }]
  type: LoadBalancer

Apply with kubectl apply -f deploy.yaml.

Scaling and rolling updates

kubectl scale deployment/web --replicas=5
kubectl set image deployment/web web=myapp:2.0
kubectl rollout status deployment/web

Declare the desired state; Kubernetes continuously reconciles the cluster to match it.