Quick answer: Kubernetes (K8s) is a platform that runs and manages containers across many servers. You describe the desired state in YAML – for example "run 3 copies of my API image" – and Kubernetes keeps it that way: restarting crashed containers, spreading load, rolling out updates and scaling. The core objects you must know are Pod, Deployment, Service, Ingress, ConfigMap, Secret and Namespace.

Docker runs containers on one machine. Kubernetes runs them reliably across a cluster of machines. It is the standard behind managed services such as Amazon EKS, Azure AKS and Google GKE, and one of the most requested skills for DevOps and cloud roles.

Architecture in one picture

             β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ Control plane ───────────┐
 kubectl ──► β”‚ API server Β· scheduler Β· controllers β”‚ ◄── etcd (cluster state)
             β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                β”‚
          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€ Worker node ─────────┐   β”Œβ”€β”€β”€β”€ Worker node ────┐
          β”‚ kubelet Β· container runtime   β”‚   β”‚ kubelet Β· runtime   β”‚
          β”‚  [Pod] [Pod] [Pod]            β”‚   β”‚  [Pod] [Pod]        β”‚
          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Core objects

Object

What it does

Pod

Smallest unit; one (or a few tightly coupled) containers sharing network and storage

Deployment

Keeps N replicas of a Pod running; handles rolling updates and rollbacks

Service

Stable internal address and load balancing for a set of Pods

Ingress / Gateway

HTTP(S) routing from outside the cluster (domains, paths, TLS)

ConfigMap

Non-secret configuration

Secret

Sensitive values (encode β‰  encrypt – enable encryption at rest or use an external secrets manager)

Namespace

Logical separation (dev, staging, team-a)

StatefulSet

For stateful apps needing stable identity and storage

Job / CronJob

Run-to-completion and scheduled tasks

HorizontalPodAutoscaler

Scales replicas based on CPU, memory or custom metrics

A complete minimal example

apiVersion: apps/v1
kind: Deployment
metadata:
  name: orders-api
spec:
  replicas: 3
  selector:
    matchLabels: { app: orders-api }
  template:
    metadata:
      labels: { app: orders-api }
    spec:
      containers:
        - name: api
          image: registry.example.com/orders-api:1.4.2
          ports: [{ containerPort: 8080 }]
          envFrom:
            - configMapRef: { name: orders-config }
            - secretRef: { name: orders-secrets }
          resources:
            requests: { cpu: "100m", memory: "256Mi" }
            limits:   { memory: "512Mi" }
          readinessProbe:
            httpGet: { path: /health/ready, port: 8080 }
          livenessProbe:
            httpGet: { path: /health/live, port: 8080 }
---
apiVersion: v1
kind: Service
metadata:
  name: orders-api
spec:
  selector: { app: orders-api }
  ports: [{ port: 80, targetPort: 8080 }]

Essential kubectl commands

kubectl apply -f k8s/                  # create/update from files
kubectl get pods -n prod -o wide
kubectl describe pod <name>            # events and errors
kubectl logs -f deploy/orders-api
kubectl exec -it <pod> -- sh
kubectl rollout status deploy/orders-api
kubectl rollout undo deploy/orders-api # rollback
kubectl scale deploy/orders-api --replicas=5
kubectl port-forward svc/orders-api 8080:80

Troubleshooting common errors

  • ImagePullBackOff – wrong image name/tag or missing registry credentials.
  • CrashLoopBackOff – app starts then exits; check kubectl logs --previous.
  • Pending – not enough CPU/memory on nodes, or a volume cannot attach.
  • OOMKilled – memory limit too low or a memory leak.
  • Service not reachable – labels in selector do not match Pod labels.

Production best practices

  1. Always set resource requests (and memory limits).
  2. Add readiness and liveness probes.
  3. Run at least 2–3 replicas and use PodDisruptionBudgets.
  4. Use immutable image tags (versions or digests), never latest.
  5. Apply RBAC with least privilege and NetworkPolicies.
  6. Run containers as non-root with read-only file systems where possible.
  7. Manage manifests with Helm or Kustomize and deploy via GitOps (Argo CD, Flux).
  8. Centralise logs, metrics and traces (Prometheus, Grafana, OpenTelemetry).

Do you even need Kubernetes?

For a single app or small team, simpler options like AWS ECS/App Runner, Azure Container Apps, Google Cloud Run or a PaaS may be cheaper and easier. Kubernetes shines when you run many services, need portability across clouds, or have a platform team.

Learning path

  1. Docker basics β†’ 2. Local cluster with kind, minikube or k3d β†’ 3. Deploy an app with Deployment + Service + Ingress β†’ 4. ConfigMaps, Secrets, probes β†’ 5. Helm and GitOps β†’ 6. Managed cluster on a cloud β†’ 7. Certifications: CKAD, CKA, CKS.

Summary

  • Kubernetes keeps your declared desired state running.
  • Learn Pod, Deployment, Service, Ingress, ConfigMap, Secret first.
  • Requests, probes, replicas and RBAC are non-negotiable in production.
  • Choose simpler platforms when K8s is overkill.