Backend8 min read

Kubernetes

Container orchestration platform - deploy, scale, and manage containerized applications across clusters with automatic healing and rolling updates.

KubernetesK8sContainersHelmDevOps

skill: Kubernetes category: Backend tags: [Kubernetes, K8s, Containers, Helm, DevOps] readingTime: 8

Kubernetes is justified when you have multiple services that need independent scaling, rolling updates, and self-healing. For a monolith or small team, Kubernetes adds operational complexity without proportional benefit - Docker Compose on a single VM or a managed PaaS (Railway, Render, Fly.io) is simpler.

Workflow

  1. Understand the core objectsKubernetes has many objects - understanding the 6 most common covers 90% of day-to-day work.
  2. Write a DeploymentA Deployment declares the desired state - Kubernetes continuously reconciles the actual state to match it.
  3. Expose with a Service and IngressA Service gives Pods a stable DNS name. An Ingress routes external HTTP/HTTPS traffic to Services by hostname or path.
  4. Manage config with ConfigMaps and SecretsHardcoding config in images violates 12-factor app principles. ConfigMaps and Secrets decouple config from the image.
  5. Package with HelmHelm charts template Kubernetes manifests - enabling parameterized deployments across environments (dev, staging, prod) without duplicating YAML.

Output Format

Kubernetes deployment: Deployment + Service + Ingress + ConfigMap + Secret + HPA, packaged as Helm chart.

k8s/
├── Chart.yaml
├── values.yaml        # Default config
├── values.prod.yaml   # Production overrides
└── templates/
    ├── deployment.yaml
    ├── service.yaml
    ├── ingress.yaml
    ├── configmap.yaml
    ├── secret.yaml
    └── hpa.yaml

Examples

Input

Output

Edge Cases & Gotchas

  • OOMKilled pods - Pod is killed when memory exceeds limits. Increase limits or fix memory leaks. Monitor with kubectl top pods.
  • ImagePullBackOff - Image can't be pulled - wrong tag, private registry missing imagePullSecret, or network issue. kubectl describe pod shows the exact error.
  • Pending pods - Pod stays Pending when no node has enough resources. kubectl describe pod shows the scheduling failure reason. Scale the node pool or reduce resource requests.
  • Secret data is only base64-encoded - Kubernetes Secrets are not encrypted at rest by default. Enable etcd encryption or use external secrets (AWS Secrets Manager, Vault) for production.

When to Break These Rules

  • Use a managed PaaS (Railway, Render, Fly.io) instead of Kubernetes for teams < 10 engineers or single-service applications - Kubernetes operational overhead isn't worth it.
  • Use AWS ECS or Google Cloud Run for containerized workloads that don't need Kubernetes' scheduling complexity - both are simpler to operate.

Reference Files

  • https://kubernetes.io/docs/home/
  • https://helm.sh/docs/

More skills in this library

Browse all technical skills - Mobile, AI/ML, Web, Backend, Design, and Product.