Microservices

Article 19: Kubernetes Basics for Microservices

By Utility Zone · 2026-01-28T11:23:02.18531

1. Objective

Understand Kubernetes fundamentals and how it runs microservices at scale.

2. Key Concepts

  • Kubernetes (K8s)
  • Pod
  • Deployment
  • Service
  • ConfigMap
  • Scaling

3. Why Kubernetes?

Problems Docker Compose cannot solve:

  • Auto-scaling
  • Self-healing
  • Rolling updates
  • Production orchestration

4. Kubernetes Architecture (High Level)

[Client]
   |
[Kubernetes Service]
   |
[Pods] -> Containers

5. Core Components Explained

  • Pod: Smallest deployable unit
  • Deployment: Manages replicas
  • Service: Stable network endpoint

6. Sample Deployment YAML

apiVersion: apps/v1
kind: Deployment
metadata:
  name: user-service
spec:
  replicas: 2
  selector:
    matchLabels:
      app: user-service
  template:
    metadata:
      labels:
        app: user-service
    spec:
      containers:
        - name: user-service
          image: user-service:latest
          ports:
            - containerPort: 8081

7. Service YAML

apiVersion: v1
kind: Service
metadata:
  name: user-service
spec:
  selector:
    app: user-service
  ports:
    - port: 80
      targetPort: 8081

8. Common Mistakes

  • Treating pods as servers
  • Hardcoding configs
  • Skipping readiness probes

9. Interview Notes

  • Kubernetes provides self-healing and scaling
  • Services provide stable networking

10. Summary

Kubernetes is the standard platform for running microservices.

11. What’s Next

Build an end-to-end microservices project.