oci-free
The free-tier ARM VM this site runs on, as code
Infrastructure as code for one free-tier ARM VM running k3s: the VM and its network in Terraform, the cluster's manifests, and the rollout that puts this site on it. Notes on what was built and why.
A server set up by hand cannot be built again the same way. Until the chart versions were written down, a rebuild would have installed whatever each chart was on the day, and the site's images used to be built on the node from a copy of a working directory rather than from what was committed.
Solo: the Terraform for the network and the instance, the cluster's manifests and Helm values, the scripts around them, and the CI that checks every one of them.
This site and its preprod copy run here as two namespaces, rolled out by the site's CI by digest and never built on the node. A rebuild is written down: apply the Terraform, apply the manifests, then each Helm release at its recorded version.
Worth knowing
- Fits Oracle's Always Free limits: one ARM instance, 2 OCPU and 12 GB
- Every Helm release installed at a version written in the repository, and CI renders each values file against it
- Each environment's deploy credential can roll out only its own namespace
- Two replicas and a disruption budget for the site's web and API, for rollouts with zero downtime
Decisions worth defending
Traefik on the node, not Oracle's load balancer.
k3s already ships Traefik, so the node takes its own traffic and the free tier's one 10 Mbps load balancer stays unused. Any allowlist by source address needs externalTrafficPolicy: Local on it, because the default rewrites every client's address into an internal one and the allowlist then refuses everybody.
The manifests name no image for the site.
CI owns that field. The site's two Deployments carry no image, so applying the manifests updates everything else and leaves the running digest alone. A manifest that said :latest would put the last release back over whatever CI had rolled out to preprod.
A deploy credential per environment.
RBAC grants verbs on objects, not on fields, so permission to patch a Deployment is permission to rewrite its whole pod template: a deploy token is worth everything in its namespace. So preprod and production each have their own account, able to roll out only its own namespace, and the production one can be read only by a release tag.
Built with
- Terraform
- OpenTofu
- Oracle Cloud
- k3s
- Kubernetes
- Helm
- Traefik
- cert-manager
- cloud-init
- Prometheus
oci-free · Notes
- Two replicas, CI-owned images, and CI for the infrastructure
- Telemetry for WindoM on the same small cluster
- The cluster pulls the site's images; CI only rolls them out
- A Kubernetes cluster on a free-tier ARM VM
Elsewhere
- WindoM — Every new tab becomes a dashboard
- Bothy — A console for one machine that asks Docker what is running
- Portfolio site — This site: a portfolio and notes in English and Hebrew, with its own admin
- Programming with Yehuda — Lesson pages built while learning React and Node
- Icaros — A car-listing web app, built while learning React and Node
- AI — Learning notes on how models train, evaluate and serve.
- Pipelines and Optimization — Measure first, then make it faster and cheaper.
- Systems and Networking — Linux, containers, storage and the wire.
- Thoughts — Lessons from building things, written down.