This project provisions an AWS EKS cluster and networking with Terraform, then deploys NGINX with Istio routing manifests.
.
├── terraform/
│ ├── providers.tf
│ ├── variables.tf
│ ├── vpc.tf
│ ├── eks.tf
│ ├── outputs.tf
│ └── terraform.tfvars
└── k8s/
├── nginx.yaml
├── istio-ingressgateway.yaml
├── gateway.yaml
└── virtual-service.yaml
Install and configure:
- Terraform >= 1.5
- AWS CLI v2
- kubectl
- Access to an AWS account with permissions to create VPC, IAM, and EKS resources
- AWS CLI profile used in
terraform/providers.tf
Verify tools:
terraform version
aws --version
kubectl version --clientOpen terraform/terraform.tfvars and confirm values:
vpc_cidr_rangeprivate_subnet_cidrpublic_subnet_cidraws_regioncluster_namecluster_version
If needed, update values before deployment.
cd terraform
terraform init
terraform fmt
terraform validate
terraform plan
terraform applyWhen apply completes, Terraform outputs cluster_endpoint from terraform/outputs.tf.
Run this from the repository root (replace placeholders from terraform.tfvars):
aws eks update-kubeconfig \
--region <aws_region> \
--name <cluster_name>Quick check:
kubectl get nodeshelm repo add istio https://istio-release.storage.googleapis.com/charts
helm repo updatekubectl create namespace istio-system
helm install istio-base istio/base -n istio-system
helm install istiod istio/istiod -n istio-system
kubectl get pods -n istio-systemhelm install istio-ingressgateway istio/gateway -n istio-system
kubectl get pods -n istio-system
kubectl get svc -n istio-system istio-ingressgatewayyou should see the istio-ingressgateway service of type LoadBalancer with an external IP pending. This is where we will add the NLB annotation to ensure it provisions an NLB instead of a classic ELB.
Now add the NLB annotation to the istio-ingressgateway service:
kubectl patch svc istio-ingressgateway -n istio-system -p '{"metadata": {"annotations": {"service.beta.kubernetes.io/aws-load-balancer-type": "nlb"}}}'
Edit both files and replace ADD YOUR DOMAIN NAME HERE with your real host:
k8s/gateway.yamlk8s/virtual-service.yaml
k8s/nginx.yaml uses namespace nginx, so create it first:
kubectl create namespace nginxkubectl apply -f k8s/nginx.yaml
kubectl apply -f k8s/istio-ingressgateway.yaml
kubectl apply -f k8s/gateway.yaml
kubectl apply -f k8s/virtual-service.yamlCheck workloads and services:
kubectl get pods -n nginx
kubectl get svc -n nginx
kubectl get svc -n istio-system istio-ingressgateway
kubectl get gateway -n istio-system
kubectl get virtualservice -n istio-systemGet load balancer hostname:
kubectl get svc istio-ingressgateway -n istio-system -o wideThen test route (after DNS points to the LB):
curl http://<your-domain>/myappcd terraform
terraform destroy