DEV Community

Cover image for How to Deploy Kubernetes Without Regretting It
Mango Developer
Mango Developer

Posted on Originally published at mangodeveloper.com

How to Deploy Kubernetes Without Regretting It

The first time I ran kubectl get pods against a real cluster, it took 90 seconds to return an empty list. I thought something was broken. Nothing was broken. That's just how Kubernetes teaches you patience. Then I deployed my first app, watched it CrashLoopBackOff for an hour, and learned that "deploying to Kubernetes" is mostly a sequence of small humiliations until you understand what the control plane is actually doing.

This is the article I needed then. We're going to deploy a real application-a web API with a database, an ingress, autoscaling, and TLS-from zero to a working cluster. Along the way I'll point out the things I've seen go wrong in production, because that's where most of the value is.

What Kubernetes Actually Is

Kubernetes is a declarative, eventually-consistent control plane for running containers across one or more hosts. You describe what you want (three replicas of an API, a Service that routes to them, an Ingress that terminates TLS), submit that description to the API server, and Kubernetes continuously works to make reality match the description. If a node dies, Kubernetes reschedules your pods. If you change a Deployment's image tag, Kubernetes rolls the pods. If a pod crashes, Kubernetes restarts it.

The mental model isn't "I'm running containers." It's "I'm submitting desired-state documents to an API, and a bunch of controllers are reconciling reality toward that state." Internalize that and 80% of Kubernetes clicks into place.

Distribution Type Cost Sweet spot
kind Local Free CI, fast tests
k3d Local Free Local dev that feels like prod
minikube Local Free Tutorials, older workflows
Docker Desktop Local Free/paid Already using Docker Desktop
EKS Managed $0.10/hr + nodes AWS shops
GKE Managed Free control plane (Standard) + nodes GCP shops, best managed experience
AKS Managed Free control plane + nodes Azure shops
k3s Self-managed Free Edge, IoT, Raspberry Pi
RKE2 Self-managed Free Self-managed, hardened

For learning, use k3d. For real work, use a managed service unless you have a strong reason not to.

Architecture at a Glance

CodeCopy

Enter fullscreen mode Exit fullscreen mode

+-------------------------+
| Control Plane |
| - API server |
| - etcd (state) |
| - scheduler |
| - controller manager |
| - cloud controllers |
+-----------+-------------+
|
+----------------+----------------+
| | |
+-----v----+ +------v-----+ +------v-----+
| Node 1 | | Node 2 | | Node 3 |
| - kubelet| | - kubelet | | - kubelet |
| - kube- | | - kube- | | - kube- |
| proxy | | proxy | | proxy |
| - pods | | - pods | | - pods |
+----------+ +------------+ +------------+

Enter fullscreen mode Exit fullscreen mode

Your code runs in pods on the nodes. The control plane decides which pod goes on which node, watches for failures, and exposes the API you talk to via kubectl.

Prerequisites and Tooling

You need:

  • docker (or another container runtime, but Docker is fine).
  • kubectl (the CLI). Install from your distro's package manager or download from dl.k8s.io.
  • A cluster. For local: brew install k3d then k3d cluster create dev. For cloud: pick your provider's managed service.
  • helm (the package manager). Optional but I'd recommend it.
  • k9s (the TUI). Not optional, in my opinion. It makes debugging 10x faster.

Verify:

BashCopy

Enter fullscreen mode Exit fullscreen mode


shell
kubectl version --client
kubectl cluster-info
kubectl get nodes

Enter fullscreen mode Exit fullscreen mode


markdown

If kubectl get nodes shows a node in Ready state, you have a cluster. Congratulations, you're already past where a lot of tutorials stop.

Project Layout

For anything non-trivial, you'll end up with something like this:

CodeCopy

Enter fullscreen mode Exit fullscreen mode


plaintext
infra/
k8s/
base/
namespace.yaml
deployment.yaml
service.yaml
configmap.yaml
secret.yaml # template, real secrets via Sealed Secrets or External Secrets
hpa.yaml
pdb.yaml
ingress.yaml
kustomization.yaml
overlays/
staging/
kustomization.yaml
patches/
prod/
kustomization.yaml
patches/
helm/
values.yaml
Chart.yaml # if you package your app as a chart

Enter fullscreen mode Exit fullscreen mode


markdown

I prefer Kustomize for apps I control (no templating, plain YAML) and Helm for third-party things (cert-manager, ingress-nginx, Prometheus). Mixing is fine and common.

Your First Real Deployment

Enough theory. Here's a complete, working set of manifests for a stateless web API. I'm going to include everything: Namespace, Deployment, Service, ConfigMap, Secret, HPA, PDB, and Ingress.

YAMLCopy

Enter fullscreen mode Exit fullscreen mode


yaml

namespace.yaml

apiVersion: v1
kind: Namespace
metadata:
name: myapp
labels:
name: myapp

Enter fullscreen mode Exit fullscreen mode


plaintext

YAMLCopy

Enter fullscreen mode Exit fullscreen mode


yaml

deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
name: api
namespace: myapp
labels:
app: api
spec:
replicas: 3
selector:
matchLabels:
app: api
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
template:
metadata:
labels:
app: api
spec:
securityContext:
runAsNonRoot: true
runAsUser: 10001
fsGroup: 10001
seccompProfile:
type: RuntimeDefault
containers:

  • name: api image: myregistry.io/myapp-api:v1.2.3 # pinned, never :latest ports:
  • containerPort: 3000 env:
  • name: DATABASE_URL valueFrom: secretKeyRef: name: api-secret key: database-url
  • name: LOG_LEVEL valueFrom: configMapKeyRef: name: api-config key: log-level
  • name: POD_NAME valueFrom: fieldRef: fieldPath: metadata.name resources: requests: cpu: 100m memory: 128Mi limits: cpu: 500m memory: 512Mi readinessProbe: httpGet: path: /health/ready port: 3000 initialDelaySeconds: 5 periodSeconds: 5 failureThreshold: 3 livenessProbe: httpGet: path: /health/live port: 3000 initialDelaySeconds: 15 periodSeconds: 10 failureThreshold: 3 securityContext: allowPrivilegeEscalation: false readOnlyRootFilesystem: true capabilities: drop: [ALL] runAsNonRoot: true runAsUser: 10001 volumeMounts:
  • name: tmp mountPath: /tmp
  • name: cache mountPath: /app/cache volumes:
  • name: tmp emptyDir: {}
  • name: cache emptyDir: {} affinity: podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution:
  • weight: 100 podAffinityTerm: labelSelector: matchLabels: app: api topologyKey: kubernetes.io/hostname
Enter fullscreen mode Exit fullscreen mode


plaintext

YAMLCopy

Enter fullscreen mode Exit fullscreen mode


yaml

service.yaml

apiVersion: v1
kind: Service
metadata:
name: api
namespace: myapp
spec:
type: ClusterIP
selector:
app: api
ports:

  • name: http port: 80 targetPort: 3000
Enter fullscreen mode Exit fullscreen mode


plaintext

YAMLCopy

Enter fullscreen mode Exit fullscreen mode


yaml

configmap.yaml

apiVersion: v1
kind: ConfigMap
metadata:
name: api-config
namespace: myapp
data:
log-level: info
feature-flags.yaml: |
features:
new_dashboard: true
beta_api: false

Enter fullscreen mode Exit fullscreen mode


plaintext

YAMLCopy

Enter fullscreen mode Exit fullscreen mode


yaml

secret.yaml (TEMPLATE - do not commit real secrets)

apiVersion: v1
kind: Secret
metadata:
name: api-secret
namespace: myapp
type: Opaque
stringData:
database-url: postgres://app:CHANGE_ME@db.myapp.svc:5432/app

Enter fullscreen mode Exit fullscreen mode


plaintext

YAMLCopy

Enter fullscreen mode Exit fullscreen mode


yaml

hpa.yaml

apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: api
namespace: myapp
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: api
minReplicas: 3
maxReplicas: 20
metrics:

  • type: Resource resource: name: cpu target: type: Utilization averageUtilization: 70
  • type: Resource resource: name: memory target: type: Utilization averageUtilization: 80 behavior: scaleDown: stabilizationWindowSeconds: 300 policies:
  • type: Percent value: 50 periodSeconds: 60
Enter fullscreen mode Exit fullscreen mode


plaintext

YAMLCopy

Enter fullscreen mode Exit fullscreen mode


yaml

pdb.yaml

apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: api
namespace: myapp
spec:
minAvailable: 2
selector:
matchLabels:
app: api

Enter fullscreen mode Exit fullscreen mode


plaintext

YAMLCopy

Enter fullscreen mode Exit fullscreen mode


yaml

ingress.yaml

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: api
namespace: myapp
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
nginx.ingress.kubernetes.io/rate-limit: "100"
spec:
ingressClassName: nginx
tls:

  • hosts: [api.example.com] secretName: api-tls rules:
  • host: api.example.com http: paths:
  • path: / pathType: Prefix backend: service: name: api port: number: 80
Enter fullscreen mode Exit fullscreen mode


plaintext

Apply them in order:

BashCopy

Enter fullscreen mode Exit fullscreen mode


shell
kubectl apply -f namespace.yaml
kubectl apply -f configmap.yaml,secret.yaml,deployment.yaml,service.yaml,hpa.yaml,pdb.yaml,ingress.yaml
kubectl -n myapp rollout status deployment/api

Enter fullscreen mode Exit fullscreen mode


markdown

That's a real deployment. Let me walk through what's happening.

Walking Through the Deployment

Namespace. Don't put things in default. Namespaces give you RBAC boundaries, network policy boundaries, and resource quota boundaries. Use them.

Deployment vs Pod. You almost never create a Pod directly. You create a Deployment, which manages a ReplicaSet, which manages Pods. The Deployment handles rolling updates and rollbacks.

strategy: RollingUpdate with maxUnavailable: 0. This means Kubernetes will spin up the new pod before killing the old one. Zero-downtime deploys require this (plus a working readiness probe).

runAsNonRoot and runAsUser: 10001. Don't run as root. Pick a UID above 10000 to avoid collisions with host users. Set it both at the pod level and the container level-the pod-level setting is the default; the container-level setting is the override.

readOnlyRootFilesystem: true. Forces the container's filesystem to be read-only. Mount emptyDir volumes at paths that need writes (/tmp, cache directories). This stops attackers who get RCE from persisting on the filesystem.

capabilities: { drop: [ALL] }. Drop all Linux capabilities. Add back only what you actually need (usually none).

Resources: requests and limits. Requests are what the scheduler uses to place pods and what the kubelet uses for cgroup shares. Limits are the hard cap. Set both. Without requests, the scheduler has no information and will pack pods badly. Without limits, one pod can starve the node.

Readiness probe vs liveness probe. Readiness = "is this pod ready to receive traffic?" If it fails, the pod is removed from the Service's endpoints but not restarted. Liveness = "is this pod healthy?" If it fails, the pod is restarted. They check different things and should hit different endpoints. /health/live should be cheap and never depend on downstream services. /health/ready should check downstream connectivity.

Pod anti-affinity. The preferredDuringSchedulingIgnoredDuringExecution block tells the scheduler to prefer placing replicas on different nodes. Without this, all three replicas can end up on one node, and a node failure takes down your entire app.

HPA behavior. The scaleDown.stabilizationWindowSeconds: 300 keeps the HPA from flapping-after a scale-up, it waits 5 minutes before scaling down. Without this, you'll scale up on a traffic spike and immediately scale down, then scale up again.

PDB. minAvailable: 2 means voluntary disruptions (node drains, upgrades) can't take below 2 replicas. This is what keeps your app alive during cluster upgrades.

Stateful Workloads: StatefulSet, PV, PVC

For databases and other stateful services, use a StatefulSet with persistent volumes. Here's the pattern for a Redis cache that needs persistence:

YAMLCopy

Enter fullscreen mode Exit fullscreen mode


yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: redis
namespace: myapp
spec:
serviceName: redis
replicas: 1
selector:
matchLabels:
app: redis
template:
metadata:
labels:
app: redis
spec:
containers:

  • name: redis image: redis:7-alpine ports:
  • containerPort: 6379 volumeMounts:
  • name: data mountPath: /data resources: requests: { cpu: 100m, memory: 128Mi } limits: { cpu: 500m, memory: 512Mi } volumeClaimTemplates:
  • metadata: name: data spec: accessModes: [ReadWriteOnce] storageClassName: gp3 resources: requests: storage: 10Gi --- apiVersion: v1 kind: Service metadata: name: redis namespace: myapp spec: clusterIP: None # headless; DNS returns pod IPs selector: app: redis ports:
  • port: 6379
Enter fullscreen mode Exit fullscreen mode


markdown

The volumeClaimTemplates block creates a PVC per replica automatically. The headless Service (clusterIP: None) gives each pod a stable DNS name: redis-0.redis.myapp.svc.cluster.local. That's the trick that makes StatefulSets useful for clustered databases.

For real databases, prefer the operator pattern. There are excellent Postgres operators (CloudNativePG, Zalando Postgres), MySQL operators (Percona, Oracle), and Redis operators (Spotahome). Running your own database on Kubernetes without an operator is asking for a 3am page when failover doesn't work the way you assumed.

Helm and Kustomize: Pick One per Job

Helm Kustomize
Model Templated YAML Patched YAML
Best for Third-party charts, distribution Your own apps, env-specific overlays
Learning curve Moderate (template language) Low (just YAML)
Validation Hard (templates render at runtime) Easy (it's always valid YAML)

I use Helm for installing things like ingress-nginx, cert-manager, and Prometheus. I use Kustomize for my own app manifests, with overlays for staging/prod. This is a common pattern and it works well.

A Kustomize overlay for staging:

YAMLCopy

Enter fullscreen mode Exit fullscreen mode


yaml

overlays/staging/kustomization.yaml

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: myapp-staging
resources:

  • ../../base images:
  • name: myregistry.io/myapp-api newTag: v1.2.3-rc.1 patches:
  • target: kind: Deployment name: api patch: |
  • op: replace path: /spec/replicas value: 1
Enter fullscreen mode Exit fullscreen mode


plaintext

Deploy with:

BashCopy

Enter fullscreen mode Exit fullscreen mode


shell
kubectl apply -k overlays/staging

Enter fullscreen mode Exit fullscreen mode


markdown

Resource Requests, Limits, and QoS

Every pod gets a QoS class based on its resource settings. There are three:

  • Guaranteed: requests == limits for CPU and memory, for every container. Highest priority, last to be killed by the kubelet under node pressure.
  • Burstable: requests set but != limits. Medium priority.
  • BestEffort: no requests or limits. First to be killed.

For production services, aim for Guaranteed. It means the kubelet won't kill your pod unless the node is truly out of memory, and your pod gets the CPU and memory you asked for.

The math: if you set requests: { cpu: 100m, memory: 128Mi } and limits: { cpu: 500m, memory: 512Mi }, the scheduler reserves 100m CPU and 128Mi memory for the pod. Under load, the pod can burst up to 500m CPU (throttled via CFS quota) and 512Mi memory (OOM-killed if it exceeds). If the node runs out of memory, Burstable pods are killed before Guaranteed pods.

CPU throttling is invisible and deadly. If your limit is 500m and you need 600m, you don't crash-you just get slow. Latency p99 jumps from 50ms to 500ms with no error. Monitor CPU throttling (container_cpu_cfs_throttled_seconds_total in Prometheus) and either raise the limit or remove it (recent Kubernetes supports removing CPU limits entirely for guaranteed CPU without throttling).

Rolling Updates and Rollbacks

A Deployment rolling update creates a new ReplicaSet and gradually shifts pods from the old ReplicaSet to the new one. With maxUnavailable: 0 and maxSurge: 1, you get one extra pod at a time, no downtime.

Watch the rollout:

BashCopy

Enter fullscreen mode Exit fullscreen mode


shell
kubectl -n myapp rollout status deployment/api

Enter fullscreen mode Exit fullscreen mode


plaintext

If it goes wrong:

BashCopy

Enter fullscreen mode Exit fullscreen mode


shell
kubectl -n myapp rollout undo deployment/api
kubectl -n myapp rollout undo deployment/api --to-revision=3
kubectl -n myapp rollout history deployment/api

Enter fullscreen mode Exit fullscreen mode


markdown

The undo is fast because the old ReplicaSet still exists (just scaled to 0). Kubernetes keeps the last 10 revisions by default (revisionHistoryLimit).

For canary deploys, use Argo Rollouts or Flagger. They give you real progressive delivery with traffic shifting, automated rollback on metrics, and analysis windows. Native Kubernetes doesn't have this.

Observability

You need three things: metrics, logs, traces.

Metrics. Install metrics-server for kubectl top to work. Install the kube-prometheus-stack Helm chart for a real Prometheus + Grafana + Alertmanager setup. It scrapes Kubernetes components, nodes, and your pods (if they expose /metrics in the right format).

Logs. Don't log to files. Log to stdout/stderr; Kubernetes collects them. Ship them somewhere with Loki, Elasticsearch, or Datadog. The kube-prometheus-stack chart installs Loki if you enable it.

Traces. Instrument your app with OpenTelemetry. Run the OTel collector as a DaemonSet. Ship traces to Tempo (also in the stack) or Jaeger or your vendor of choice.

A practical starting point: helm install kube-prometheus-stack prometheus-community/kube-prometheus-stack. You get dashboards for everything. Add your own app's dashboard once you have metrics.

Cost Considerations

Kubernetes is expensive if you let it be. The levers:

  • Right-size your nodes. A 2-CPU node is too small (system components eat half of it). A 64-CPU node is too big (a single failure takes out a lot of work). 4-8 CPU nodes is the sweet spot for most workloads.
  • Use spot/preemptible nodes. Put stateless workloads on spot nodes (with a PDB!). 60-90% cost reduction. Don't put databases on spot.
  • Cluster autoscaler. Scales node count based on pending pods. Without it, you'll either over-provision or have pods stuck pending.
  • Set requests honestly. A pod that requests 1 CPU and uses 50m is wasting money. A pod that requests 50m and uses 1 CPU is being throttled. Both are bad.
  • Don't run your own control plane unless you have to. GKE's Standard tier gives you a free control plane. EKS charges $73/month for the control plane. Self-hosted control plane is one more thing to operate.
  • Delete what you don't use. Stale namespaces, abandoned charts, dev clusters left running over the weekend. Set up Kubecost or OpenCost to see where money is going.

A reasonable budget for a small production cluster: $200-500/month for the cluster itself, plus your actual workload costs.

Production Hardening

Things you must do before going to production:

  1. RBAC. Don't give everyone cluster-admin. Use rolebindings per namespace. Audit with kubectl auth can-i --list --as=<user>.
  2. Network policies. Default-deny ingress to every namespace, then explicitly allow what's needed.
  3. Pod Security Admission. Set the restricted profile on production namespaces. It enforces runAsNonRoot, readOnlyRootFilesystem, dropped capabilities, and so on.
  4. etcd encryption at rest. Enable it on your cluster. Secrets in etcd are otherwise stored in plain text (just base64-encoded, which is not encryption).
  5. Image admission control. Use Kyverno or OPA Gatekeeper to require images come from your registry, have a digest, and pass a scan.
  6. Audit logging. Enable API server audit logs. Ship them to your SIEM.
  7. Backup etcd. If you're running your own control plane. Managed services do this for you.
  8. Upgrade regularly. Kubernetes releases three minor versions per year. Each version is supported for ~14 months. Stay within one minor of the latest.
  9. Multi-AZ. Spread nodes across availability zones. Use topology spread constraints to spread pods. A single-AZ cluster will eventually fail.

Common Mistakes

Using image: latest. Kubernetes won't pull the new image on a Deployment update if imagePullPolicy isn't Always (which is the default for :latest tags, but you've now coupled behavior to tag naming). Worse, rolling back to "the previous version" doesn't work because the previous version was also latest. Pin to a tag or, better, a digest (image: myregistry.io/myapp@sha256:abc123...).

No requests or limits. The scheduler places pods randomly, nodes get overcrowded, pods get OOM-killed unpredictably. Always set resources.

No PDB. A node drain during upgrade takes down your only replica. Two minutes of downtime you didn't have to have.

Readiness probe == liveness probe. A failing downstream dependency now causes your pod to restart, which doesn't fix anything and makes the problem worse.

Mounting secrets as environment variables. Environment variables leak in crash dumps, in kubectl describe, in application logs. Mount secrets as files (secretKeyRef with volumeMounts) and read them on startup. Tools like Reloader restart pods when secrets change.

Putting databases in Deployments. Use StatefulSets. Use operators. Don't roll your own.

Trusting kubectl get pods is green so everything is fine. A pod in Running state can be returning 500s. Watch your metrics, not your pod phases.

Troubleshooting

CrashLoopBackOff. The pod is starting, crashing, restarting, repeat. Get the logs: kubectl -n myapp logs <pod> --previous. The --previous flag shows logs from the crashed container, not the new attempt. Common causes: bad config, missing secret, app bug, OOM (check kubectl describe pod <pod> for Last State: Terminated, Reason: OOMKilled).

ImagePullBackOff. Kubernetes can't pull the image. Wrong name, wrong tag, missing credentials, registry rate-limited. Check kubectl describe pod <pod> and look at the Events section. For private registries, create an imagePullSecret and reference it in the pod spec.

OOMKilled. Pod exceeded its memory limit. Either raise the limit or fix the memory leak. Look at kubectl top pod to see actual usage.

Pod stuck in Pending. The scheduler can't place it. Usually insufficient resources on any node, or no node matches a nodeSelector/toleration/affinity. kubectl describe pod <pod> -> Events.

Pod stuck in Terminating. Usually a finalizer that's not completing, or a stuck preStop hook, or a PVC that can't detach. kubectl -n myapp delete pod <pod> --force --grace-period=0 is the nuclear option, but understand why it's stuck first or it'll happen again.

HPA not scaling. Check kubectl -n myapp describe hpa api. If the message says "missing request for cpu," your deployment doesn't set CPU requests-the HPA can't compute utilization. If it says "the HPA was able to successfully calculate a replica count," it's working but the threshold isn't being hit.

Can't reach a Service from inside the cluster. Check kubectl -n myapp get endpoints api. If it's empty, no pods match the Service's selector (or no pods are Ready). If it has IPs, the Service is fine-check network policies.

CI/CD: GitOps with Argo CD

The cleanest deployment model for Kubernetes is GitOps: your manifests live in a git repo, and a tool running in the cluster continuously reconciles the cluster to match the repo. Argo CD is the most popular choice.

Install:

BashCopy

Enter fullscreen mode Exit fullscreen mode


shell
helm install argocd argo/argo-cd -n argocd --create-namespace

Enter fullscreen mode Exit fullscreen mode


plaintext

Define an Application:

YAMLCopy

Enter fullscreen mode Exit fullscreen mode


yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: myapp
namespace: argocd
spec:
project: default
source:
repoURL: https://github.com/myorg/myapp-infra
targetRevision: main
path: overlays/prod
destination:
server: https://kubernetes.default.svc
namespace: myapp-prod
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:

  • CreateNamespace=true
Enter fullscreen mode Exit fullscreen mode

Now a merge to main deploys to production. Argo CD shows you drift, sync status, and history. It's the single biggest reliability improvement you can make to a Kubernetes workflow.

For progressive delivery, layer Argo Rollouts on top: canary, blue-green, analysis-based promotion.

Alternatives

Tool What it is When to choose
Kubernetes General-purpose container orchestrator When you need its features
Docker Swarm Simpler orchestrator built into Docker Almost never (mostly dead)
HashiCorp Nomad Simpler orchestrator, single binary When K8s is too much, you have non-container workloads, or you value simplicity
AWS ECS AWS-only container orchestrator AWS shops that don't need K8s features
AWS Fargate Serverless container execution When you don't want to manage nodes
Azure Container Apps Serverless K8s-based Azure shops, microservices
Google Cloud Run Serverless containers GCP shops, event-driven, simple services

If your workload is "run these 3 containers and don't think about it," Cloud Run or Fargate is cheaper and simpler than Kubernetes. If you need fine-grained control, multi-cluster, custom scheduling, or you're operating at large scale, Kubernetes earns its complexity.

Real-World Use Cases

  • Multi-service SaaS platforms. The canonical K8s use case. Multiple services, autoscaling, canary deploys.
  • Internal developer platforms. K8s as the substrate, with Backstage or Port on top for developer UX.
  • ML/AI workloads. K8s with GPU nodes, Kueue or Volcano for batch scheduling, Kubeflow for ML pipelines.
  • Edge/IoT. k3s on edge devices, managed centrally.
  • Batch processing. K8s Jobs and CronJobs for ETL, data processing, scheduled tasks.

Conclusion

Kubernetes has a deserved reputation for complexity, but the complexity is mostly in the learning curve, not in the day-to-day. Once you internalize the declarative model-describe what you want, let controllers reconcile-most operations become routine. Deployments roll out, HPA scales you up, PDB keeps you safe during drains, Argo CD keeps the cluster in sync with git.

The mistake is to start with Kubernetes. Start with Docker Compose. Move to Kubernetes when you've felt the pain that Kubernetes solves: multi-host scheduling, rolling deploys across nodes, autoscaling. The pain is what makes the complexity feel worth it. Without the pain, Kubernetes is just YAML you don't understand.


Originally published on Mango Developer.

Top comments (0)