All projects

Cloud & systems / PROJECT NOTES

Multi-Node Kubernetes Cluster on AWS

A 2-node k3s cluster provisioned on AWS EC2 with Terraform, running a containerized URL shortener behind a load-balanced Service, with Prometheus and Grafana observability deployed via Helm.

01 / OVERVIEW

The idea behind it.

A production-style Kubernetes cluster built from the ground up to deepen my understanding of container orchestration and infrastructure automation. Infrastructure: Terraform provisions two EC2 instances on AWS as Kubernetes nodes — one control-plane, one worker — running k3s, a lightweight Kubernetes distribution. Provisioning is fully declarative and repeatable: terraform apply recreates the entire cluster's infrastructure from a clean state. Application: I containerized a URL shortener application I built and deployed it as a Kubernetes Deployment, exposed via a Service for load-balanced access across the cluster. Pods are scheduled across both nodes, giving the app resilience against a single node going down. Observability: Prometheus and Grafana were installed with Helm charts to monitor cluster health and application performance — tracking CPU and memory usage per node, pod-level resource consumption, and live application traffic through custom Grafana dashboards.

02 / FEATURES

What it does.

  • 012-node k3s cluster (one control-plane, one worker) provisioned on AWS EC2
  • 02Infrastructure as declarative, version-controlled Terraform code — terraform apply rebuilds the cluster from a clean state
  • 03Containerized URL shortener deployed as a Kubernetes Deployment with resource requests/limits
  • 04Horizontal pod scaling with pods scheduled across both nodes for single-node-failure resilience
  • 05Kubernetes Services for load-balanced traffic distribution across pods and nodes
  • 06Prometheus and Grafana installed via Helm for cluster-wide observability
  • 07Custom Grafana dashboards for per-node CPU/memory, pod-level resource use, and live application traffic

03 / CHALLENGES

The problems worth solving.

  • 01Wiring the k3s control-plane and worker together across EC2 instances with the right security group and networking rules
  • 02Making the Terraform configuration genuinely repeatable rather than a one-time provisioning script
  • 03Setting resource requests and limits that let pods schedule across both nodes without starving them
  • 04Configuring Prometheus scrape targets so node and pod metrics were actually collected from the whole cluster
  • 05Exposing the application externally from a self-managed cluster without a cloud-provider load balancer integration

04 / LEARNINGS

What I took away.

  • 01How Kubernetes schedules pods across nodes, and what Services actually do for load balancing
  • 02Infrastructure as code with Terraform — declarative state, plan/apply, and reproducible environments
  • 03Helm as a packaging layer for deploying complex stacks like Prometheus and Grafana
  • 04Reading cluster health from real metrics instead of guessing: per-node CPU/memory and pod resource consumption
  • 05Why resource requests/limits and horizontal scaling matter for reliability under load
  • 06The operational difference between running a container and operating a cluster

KEEP EXPLORING

Real-Time Multiplayer Chess