12.1 · The hosting choice map
| Option | When |
|---|---|
| Render / Railway / Fly.io / Heroku | Small teams; speed-to-prod wins. |
| Vercel / Netlify | Web frontend + edge functions. |
| AWS / GCP / Azure managed (ECS, Cloud Run, App Service) | You need cloud-native services next door. |
| Kubernetes (EKS, GKE, AKS, self-managed) | Many services, multiple teams, complex networking, strict portability. |
| Cloudflare Workers / Vercel Edge / Deno Deploy | Global low-latency, near-zero cold starts. |
| Bare metal / Hetzner | Predictable cost, fewer abstractions. |
12.2 · Containers
- Multi-stage Dockerfiles: build stage → tiny runtime stage (distroless / Alpine).
- Pin base image digests; rebuild weekly; scan with Trivy / Grype.
- Build with BuildKit; cache layers; produce SBOM (Syft).
- Sign with Cosign (SLSA); record provenance.
12.3 · Kubernetes primitives every TL must know
| Object | What it is |
|---|---|
| Pod | Smallest deployable unit; usually one container plus sidecars. |
| Deployment | Declarative ReplicaSet manager; rolling updates. |
| StatefulSet | Stable network IDs + persistent volumes; for DBs & stateful services. |
| DaemonSet | One pod per node (logging agent, CNI, GPU drivers). |
| Job / CronJob | Batch + scheduled work. |
| Service | Stable virtual IP + DNS over a set of pods. |
| Ingress / Gateway API | External HTTP routing; Gateway API is the modern replacement for Ingress. |
| ConfigMap / Secret | Externalised config; Secrets via External Secrets Operator + Vault. |
| HPA / VPA / KEDA | Autoscaling on CPU/memory/events. |
| CRD + Operator | Custom resources + controller; how everything fancy on K8s works. |
12.4 · Helm, Kustomize, Argo
- Helm — templated YAML charts; the package format of K8s.
- Kustomize — overlay-based, no templating. Built into kubectl.
- ArgoCD / Flux — GitOps controllers; the cluster reconciles to what git says.
- Argo Workflows — DAG-based batch jobs (think Airflow on K8s).
- Argo Rollouts — canary / blue-green deploys natively.
12.5 · Infrastructure as Code
| Tool | Notes |
|---|---|
| Terraform / OpenTofu | HCL; ubiquitous; massive provider ecosystem. |
| Pulumi | Real languages (TS, Python, Go); great for code-savvy teams. |
| AWS CDK | Code that compiles to CloudFormation; AWS-only. |
| Crossplane | Manage cloud resources as K8s objects; GitOps-friendly. |
Rule: every long-lived resource lives in git. Console clicks are emergencies, not policy.
12.6 · GitOps in one paragraph
The desired state of your system (apps, infra, configs) lives in git. A controller (ArgoCD / Flux) continuously reconciles the cluster to git. Deploys are PRs. Rollbacks are git reverts. Audit is git log.
12.7 · Multi-region & DR
- Active-active vs active-passive — pick based on RPO/RTO.
- Global LB (Cloudflare, AWS Global Accelerator) for traffic steering.
- Data is the hard part — async replication, geo-partitioning, or follower reads.
- Run a game day twice a year: actually fail over to the secondary region.
12.8 · Edge platforms
- Cloudflare Workers + R2 + D1 + Durable Objects + Queues = full edge stack.
- Vercel Edge Functions are V8 isolates with tight Next.js integration.
- Deno Deploy / Bun Cloud are growing.
- Edge wins on geo latency & cold starts; loses on long-running heavy compute.
12.9 · Serverless / functions
- AWS Lambda, Cloud Functions, Azure Functions — pay per request.
- Great for spiky, low-volume, event-triggered workloads.
- Cold starts hurt; provisioned concurrency / SnapStart mitigate.
- Don't put a serverless function in the request path of a chatty client without warmup & concurrency planning.
12.10 · PaaS & internal developer platforms
- Heroku-style: Render, Railway, Fly.io, Cloud Run — get an idea live in minutes.
- Internal Developer Platforms: Backstage (Spotify), Port, Cortex — service catalogue, scaffolding, scorecards.
- A good IDP is what turns "lots of K8s" from a tax into leverage.
12.11 · Self-check
Q1 · "Desired state in git, controller reconciles cluster". Pattern name?
CI/CD
GitOps
DevOps
DevSecOps