← All bricks

Kubernetes · Advanced

Kubernetes Deployment with Probes & Limits

Take a container to a production-minimum Kubernetes deployment: a Deployment and Service, config and secrets, readiness and liveness probes, resource limits and autoscaling.

Anyone can kubectl run a pod; keeping it healthy under load is the job. Here we take an app from a bare Deployment to a production-minimum setup one manifest field at a time — a Service to reach it, ConfigMaps and Secrets for configuration, readiness and liveness probes so Kubernetes knows what "healthy" means, resource requests and limits, and a HorizontalPodAutoscaler. Each step adds one piece and names the incident it prevents.

What you'll build

  • Run an app as a Deployment behind a Service
  • Supply configuration with a ConfigMap and a Secret
  • Add readiness and liveness probes
  • Set resource requests and limits
  • Scale automatically with an HPA

Contents

  1. A Deployment
  2. Declare the port
  3. A Service to reach it
  4. Non-secret config
  5. Inject the config
  6. Secrets, kept apart
  7. Inject the secret too
  8. Readiness: don't route too early
  9. Liveness: restart what's wedged
  10. Requests and limits
  11. Scale with load