IN·85
Infrastructure Projects
Eight build-it-yourself projects that take the tiffin centre's services from a laptop to a production-shaped platform: a hardened Linux host, hand-built containers, minimal and signed images, a TLS edge proxy, a Kubernetes deployment with probes and policies, zero-downtime releases, autoscaling and failure drills, and a GitOps pipeline, each with milestones, measurable definitions of done and stretch goals.
How to approach the projects
One platform, built up in layers
The labs in this volume each isolate one mechanism. These projects put them together for one application: the tiffin centre's services from Volumes 2–5 (or the volume's tiffin service if you're starting here), taken from "runs on my laptop" to a small platform you'd be comfortable operating. Use a cloud VM or a local machine with Linux (or WSL2), Docker, a lightweight Kubernetes (k3s, kind or minikube), and a Git repository for everything.
| # | Project | Main chapters | Roughly |
|---|---|---|---|
| 1 | A hardened Linux host for one service | 79 | a weekend |
| 2 | A container runtime by hand | 80 | 1 week |
| 3 | Minimal, scanned and signed images | 81 | 1 week |
| 4 | A TLS edge proxy with health-aware load balancing | 82 | 1 week |
| 5 | The application on Kubernetes, properly | 83 | 1–2 weeks |
| 6 | Zero-downtime releases and a canary pipeline | 84 | 1 week |
| 7 | Autoscaling, limits and failure drills | 80, 83 | 1 week |
| 8 | GitOps for the whole platform | 81, 83, 84 | 1–2 weeks |
New to infrastructure? Do them in order. Experienced? Skim 1–3 and treat the stretch goals of 4–8 as the assignment.
The working method
- Everything as code: shell provisioning scripts or Ansible, Dockerfiles, proxy configs, manifests, Helm/Kustomize, pipelines. If you clicked it, it doesn't count.
- Write the definition of done first, as checks a script can run.
- Measure under load: every "zero downtime" or "survives X" claim comes with a load generator's error count.
- Break it on purpose: kill processes, fill disks, exceed limits, delete pods and nodes, and record what happened.
- Write a README per project with decisions, alternatives and measurements.
The eight projects
Project 1: a hardened Linux host
Goal. One VM running the service under systemd as a locked-down unit, with logs, rotation, a firewall and basic monitoring.
Milestones. A provisioning script (idempotent: running it twice changes nothing) → an unprivileged service user → a systemd unit with Restart=on-failure, LimitNOFILE, MemoryMax, ProtectSystem=strict, NoNewPrivileges, PrivateTmp → journald with retention limits → nftables allowing only SSH and HTTPS → unattended security upgrades → node_exporter or a simple metrics script.
Done when. systemd-analyze security scores the unit below 3.0 ("OK"); killing the process with SIGKILL brings it back within 5 seconds; SIGTERM drains in-flight requests (0 errors under load); a port scan from outside shows only 22 and 443; a disk-filling script triggers an alert before services fail.
Stretch. Socket activation; an AppArmor profile for the service; SSH with certificates instead of keys; a CIS benchmark scan with fixes.
Project 2: a container runtime by hand
Goal. A small program (Go, Rust or C) that runs a command in its own namespaces, root filesystem and cgroup: a toy runc.
Milestones. clone with new PID, UTS, mount and network namespaces → pivot_root into an Alpine rootfs and mount /proc → cgroup v2 memory and CPU limits from flags → a veth pair to a host bridge with NAT → user namespace mapping so it runs without root.
Done when. mybox run --mem 64m --cpus 0.5 alpine sh gives a shell that sees itself as PID 1, its own hostname and network, can reach the internet, is OOM-killed beyond 64 MB, and measures about 50% CPU in a busy loop; the same works as an unprivileged user.
Stretch. Pull and unpack an OCI image from a registry yourself; overlayfs layers; seccomp filtering; compare start-up time with runc.
Project 3: minimal, scanned and signed images
Goal. Production images for every service with a repeatable, secure build.
Milestones. Multi-stage Dockerfiles with cache mounts → non-root users, read-only root filesystems, no shells where possible (distroless/scratch) → multi-arch builds (amd64 and arm64) → SBOM generation and vulnerability scanning in CI with a failing threshold → signing with cosign (keyless if your CI supports OIDC) and verification → a local or private registry with digests pinned in deployments.
Done when. Every image is under a size budget you set and justify (for example, under 30 MB for Go, under 200 MB for JVM services); rebuilding after a one-line change takes under 20 seconds; CI fails on a planted critical CVE; an unsigned image is rejected at deploy time; secrets never appear in any layer (a script checks).
Stretch. Reproducible builds (two builds produce the same digest); SLSA provenance attestations; automated base-image update PRs (Renovate).
Project 4: a TLS edge proxy
Goal. One public entry point for all services, with automatic certificates and good defaults.
Milestones. NGINX, HAProxy, Caddy or Envoy in front of two instances of each service → HTTPS with ACME certificates (or a local CA for a lab) and HTTP→HTTPS redirects → routing by host and path → active health checks and load-aware balancing → timeouts aligned with the services → forwarded headers and request IDs → rate limits per client → access logs in JSON → metrics scraped by Prometheus.
Done when. SSL Labs (or testssl.sh) grades the endpoint A or better; killing one backend under load produces 0 client errors; a slow backend doesn't raise p99 for the others' routes; a client exceeding its rate limit gets 429 with Retry-After; every request is traceable from proxy log to application log by ID.
Stretch. HTTP/3; mTLS from the proxy to backends; a WAF ruleset (Coraza/ModSecurity) with false-positive tuning; Envoy with xDS from a small control plane you write.
Project 5: the application on Kubernetes, properly
Goal. All services running on Kubernetes with production-quality manifests.
Milestones. Namespaces per environment → Deployments with requests, limits, startup/readiness/liveness probes and graceful shutdown → ConfigMaps and Secrets (encrypted at rest or from an external store) → Services and an Ingress or Gateway API route → PostgreSQL as a StatefulSet with a PersistentVolume (or an operator such as CloudNativePG) → NetworkPolicies allowing only required flows → RBAC with a ServiceAccount per service → Pod Security Standards at restricted.
Done when. kubectl apply -k (or helm install) builds the whole environment from empty; every pod runs as non-root with a read-only root filesystem and no added capabilities; deleting any pod causes 0 errors under load; a NetworkPolicy test shows the orders service can't reach the database's admin port; a ServiceAccount can do only what its RoleBinding grants (kubectl auth can-i checks).
Stretch. A Kyverno or Gatekeeper policy set enforcing the above on every deployment; a small operator (controller-runtime or kopf) that manages a custom resource for "TiffinMenu".
Project 6: zero-downtime releases
Goal. A release process where deploys are boring.
Milestones. Rolling updates with maxUnavailable: 0, readiness gating, preStop delays and tuned grace periods → a database migration Job run before deploys, using expand/contract → a canary with weighted routing → automated analysis (Argo Rollouts or Flagger with Prometheus queries) → feature flags for user-facing changes → a documented rollback procedure.
Done when. 20 consecutive releases under constant load produce 0 failed requests; a deliberately bad version (5% errors) is rolled back automatically by the canary analysis within 5 minutes and before reaching more than 20% of traffic; a column rename ships in three releases, each rolled back once to prove it's reversible.
Stretch. Blue/green for the database-heavy service with a measured switch time; deployment windows and freeze rules enforced by the pipeline; DORA metrics (deployment frequency, lead time, change failure rate, time to restore) collected automatically.
Project 7: autoscaling, limits and failure drills
Goal. A platform that scales with load and survives node and dependency failures.
Milestones. metrics-server and HPA on CPU, then on a custom metric (requests per second or queue length via KEDA) → right-sized requests from measured usage (VPA in recommend mode) → PodDisruptionBudgets and topology spread across nodes → a multi-node cluster (k3s agents or kind nodes) → drills: drain a node, kill a node, fill a node's disk, OOM a pod, slow a dependency with Toxiproxy.
Done when. A load ramp from 10 to 500 requests per second keeps p99 under your SLO with pods scaling out and back in; draining a node during load causes 0 errors; each drill has a written runbook entry: symptoms, detection (which alert fired, and when), mitigation and time to recover.
Stretch. Cluster autoscaling on a cloud provider (Karpenter or Cluster Autoscaler); cost per request reported per service; a chaos experiment schedule with Chaos Mesh or Litmus.
Project 8: GitOps for the whole platform
Goal. Git as the single source of truth for every environment.
Milestones. A repository layout for apps and environments (Kustomize overlays or Helm values) → CI that builds, tests, scans, signs and pushes images and opens a PR bumping the digest → Argo CD or Flux syncing the cluster from Git with drift detection → promotion from staging to production by PR → secrets with SOPS or Sealed Secrets → notifications for sync failures.
Done when. A merged PR reaches staging within 5 minutes with no manual commands; a manual kubectl edit in production is reverted automatically and reported; rollback is a git revert that completes within 5 minutes; a new environment can be created from Git alone in under 30 minutes.
Stretch. Policy checks on PRs (conftest/OPA) before merge; preview environments per pull request; multi-cluster deployment with ApplicationSets.
Tracking your progress
Portfolio checklist
Keep one repository with provisioning scripts, Dockerfiles, proxy configs, manifests, pipelines, drill runbooks and a README per project. Infrastructure evidence is measured behaviour: "systemd unit exposure 2.4; image 9 MB, signed and verified at admission; 0 errors across 20 releases under 200 req/s; bad canary auto-rolled back at 10% traffic in 3 min; node drain with 0 errors; drift reverted in 40 s" is what makes a platform portfolio credible.
Mapping to mastery levels
Completing projects 1–3 with their checks puts you at L2 across the volume. Doing their stretch goals and explaining each failure you reproduced is L3–L4. Designing and defending projects 4–8 (edge architecture, Kubernetes security and tenancy, release strategy, capacity and resilience, GitOps) is L5 work, the level platform and SRE interviews probe.