intermediatekubernetesterraformtutorial

Spin Up a Production-Ready Kubernetes Cluster With Terraform

A 40-minute walkthrough: Terraform module, EKS or AKS, Argo bootstrap, and a working ingress by the end.

By Mohamed SalahApr 23, 2026

Spin Up a Production-Ready Kubernetes Cluster With Terraform

By the end of this tutorial you'll have:

  • A Kubernetes cluster (EKS or AKS) provisioned by Terraform.
  • ArgoCD bootstrapped and serving its UI through Traefik.
  • A sample workload deployed end-to-end.

Prerequisites

  • An AWS or Azure account with quota for 3 nodes.
  • terraform ≥ 1.7 and kubectl ≥ 1.28.
  • Patience for a ~15-minute initial apply.

Step 1 — The cluster module

module "cluster" {
  source  = "terraform-aws-modules/eks/aws"
  version = "~> 20.0"

  cluster_name    = "demo"
  cluster_version = "1.30"

  vpc_id          = module.vpc.vpc_id
  subnet_ids      = module.vpc.private_subnets

  eks_managed_node_groups = {
    default = {
      min_size     = 2
      max_size     = 6
      desired_size = 3
      instance_types = ["t3.large"]
    }
  }
}

Step 2 — Bootstrap ArgoCD

helm repo add argo https://argoproj.github.io/argo-helm
helm install argocd argo/argo-cd -n argocd --create-namespace \
  --values - <<'EOF'
server:
  extraArgs: ["--insecure"]
EOF

Step 3 — First app via Argo

Point ArgoCD at a repo with a hello-world chart. Watch it sync. Then point your browser at the ArgoCD UI and notice: the cluster has gone from empty to live infrastructure, every artefact in git.

Step 4 — What's next

Now wire up Prometheus + Grafana + Loki through Argo. The same pattern: one app per stack component, each in its own git folder, all synced by one meta-application. You're done.