Skip to main content
PreparationZone Logo
PrepZone

Kubernetes Deployment Patterns

Pods, services, ingress, HPA and rolling updates for stateless microservices on K8s.

Pass checkpoint below

Read these first

Why this matters

  • StreamHub runs 40+ microservices on EKS — understanding Deployments, Services, Ingress, and HPA is how you ship without downtime.
  • Stateless services scale horizontally by adding pods; stateful workloads need StatefulSets, persistent volumes, and careful rollout strategy.
  • Probes (liveness, readiness, startup) are the difference between graceful deploys and cascading failures.

Kubernetes primitives for StreamHub

  • Deployment — manages ReplicaSets; declarative rolling updates and rollbacks.
  • Service — stable ClusterIP or LoadBalancer endpoint across pod IPs.
  • Ingress — L7 routing, TLS termination, path-based rules to backend services.
  • HPA — Horizontal Pod Autoscaler scales replicas on CPU, memory, or custom metrics.
  • ConfigMap / Secret — externalise configuration; mount as env vars or files.

StreamHub on Amazon EKS

NETWORK
Route 53alias record
NETWORK
ALB IngressL7 routing
COMPUTE
EKS cluster3 AZ node groups
COMPUTE
Deployment: a…6 pods · HPA
COMPUTE
Deployment: w…KEDA on MSK
SECURITY
IRSAS3 · MSK IAM
Ingress → Deployments with HPA, probes, and IRSA for AWS access.

Deployment manifest

Java
apiVersion: apps/v1
kind: Deployment
metadata:
  name: streamhub-api
  labels:
    app: streamhub-api
    version: v2.8.1
spec:
  replicas: 6
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 2
      maxUnavailable: 1
  selector:
    matchLabels:
      app: streamhub-api
  template:
    metadata:
      labels:
        app: streamhub-api
        version: v2.8.1
    spec:
      terminationGracePeriodSeconds: 45
      containers:
        - name: api
          image: registry.streamhub.io/api:2.8.1
          ports:
            - containerPort: 8080
          resources:
            requests:
              cpu: 500m
              memory: 512Mi
            limits:
              cpu: 1000m
              memory: 1Gi
          env:
            - name: OTEL_EXPORTER_OTLP_ENDPOINT
              value: http://otel-collector:4317
          livenessProbe:
            httpGet:
              path: /health/live
              port: 8080
            initialDelaySeconds: 30
            periodSeconds: 10
          readinessProbe:
            httpGet:
              path: /health/ready
              port: 8080
            initialDelaySeconds: 10
            periodSeconds: 5
          startupProbe:
            httpGet:
              path: /health/ready
              port: 8080
            failureThreshold: 30
            periodSeconds: 5

The rest of this guide is part of Pro

Free covers every fresher guide in full. Pro unlocks Senior, Staff and Architect guides across every track.

Still to come · 4 sections

  • Service and Ingress
  • Horizontal Pod Autoscaler
  • Pod Disruption Budget
  • Observability hooks

Test yourself

Answer these before moving on — recall is what makes it stick.