DEV Community

Cover image for Deploy Rancher on AWS EKS using Terraform & Helm Charts
Kunal Shah
Kunal Shah

Posted on • Updated on

Deploy Rancher on AWS EKS using Terraform & Helm Charts

Step-by-step guide to deploy Rancher on AWS EKS using Terraform and Helm Charts.

AWS Cloud Hands-on Lab Practice Series

Project Overview Image

Project Overview —

This project revolves around AWS EKS where we deploy Rancher (platform for Kubernetes management). Rancher is a Kubernetes management tool to deploy and run clusters anywhere and on any provider. Amazon EKS & Rancher is a vital combination when it comes to managing multi-cluster Kubernetes workloads from a Single Dashboard.


Architecture Overview Image

First, let’s understand the real-world use case:

  • Hybrid Cloud Management for a Global E-Commerce Platform:
    Imagine a large e-commerce platform that serves customers globally. The platform’s infrastructure spans multiple regions to ensure low-latency access and high availability. Rancher provides a unified dashboard for managing EKS clusters spread across various regions.

  • Finance: Multi-Tiered Application Deployment:
    A financial institution is migrating its legacy monolithic applications to a microservices architecture on AWS EKS. Rancher simplifies the deployment of microservices across EKS clusters in different regions.

  • Retail: Seasonal Application Scaling:
    A retail chain experiences significant fluctuations in website traffic during holiday seasons. Rancher enables automated scaling of applications based on predefined policies.

  • Manufacturing: Edge Computing for IoT Devices:
    A manufacturing company utilizes IoT devices across its facilities to monitor and optimize production processes. Rancher supports the deployment of Kubernetes clusters at the edge, close to IoT devices.

  • Media and Entertainment: Content Delivery Optimization:
    A media streaming service operates globally and needs to optimize content delivery for users. Rancher integrates with AWS services like Amazon CloudFront for efficient content caching.

These diverse use cases demonstrate the versatility of Rancher on AWS EKS in addressing industry-specific challenges and enhancing the management of Kubernetes clusters in various contexts. Rancher simplifies operations, enhances security, and provides a unified platform for managing the hybrid cloud environment.

Prerequisite —

  1. AWS ACCOUNT with admin privileges.
  2. AWS EC2 Instance (Bastion Host)
  3. Terraform Installation Guide
  4. HELM Installation Guide
  5. KUBECTL Installation Guide

AWS Services Usage —

  • AWS EC2

Step-by-Step Guide -

Step 1: Clone the repo & check the versions of installed tools

  • Login to AWS EC2 instance (Bastion Host).
  • Install tools — Terraform, helm, kubectl, aws cli.
  • Check versions: aws version, kubectl version, helm version.
  • Now clone the Git Repo: Terraform Repo Link
  • Give Star & Follow me on GitHub
  • Repo has 3 files —,, &

Step 2: Deploying AWS resources through Terraform.

Now go to the folder location & run below commands.

Terraform init
Terraform validate
Terraform plan
Terraform apply
Enter fullscreen mode Exit fullscreen mode

  • This will deploy infrastructure resources in AWS.
  • It will take around 15–20 mins to get it deployed.
  • It will have 1 EKS master cluster & 2 worker nodes (ec2 spot instances) attached to the AWS EKS master cluster.

STEP 3 : Add Helm Repositories

helm repo add jetstack

helm repo add ingress-nginx

helm repo add rancher-latest

helm repo update

helm repo list
Enter fullscreen mode Exit fullscreen mode

STEP 4 : Access the EKS Cluster through kubectl

  • Run below mentioned commands from EC2 Bastion:
aws eks - region me-south-1 update-kubeconfig - name <eks_cluster_name>

kubectl get nodes

kubectl get all -A
Enter fullscreen mode Exit fullscreen mode
  • TIP — If you face any permission issue then change permission for ~/.kube/config

  • This confirms that Cluster on EKS is ready with requested worker nodes.

STEP 5 : Ngnix Ingress Installation (exposing to Internet)

  • Run below mentioned command :
helm upgrade --install \
      ingress-nginx ingress-nginx/ingress-nginx \
      --namespace ingress-nginx \
      --set controller.service.type=LoadBalancer \
      --version 4.8.3 \
Enter fullscreen mode Exit fullscreen mode

  • Check the services: kubectl get services -n ingress-nginx

  • Copy & save Loadbalancer DNS ( It will used in step 7)

STEP 6 : Install Certificates manager.

helm upgrade --install cert-manager jetstack/cert-manager \
      --namespace cert-manager \
      --create-namespace \
     --version $CERT_MANAGER_VERSION
Enter fullscreen mode Exit fullscreen mode
  • Check the pods : kubectl get pods -namespace cert-manager ( 3 pods should be in Running status)

  • Lets have new certificate from letsencrypt
helm upgrade --install letsencrypt devpro/letsencrypt \
      --set registration.emailAddress=$EMAIL_ADDRESS \
      --namespace cert-manager
Enter fullscreen mode Exit fullscreen mode
  • Now run this command : kubectl get clusterissuer -n cert-manager ( 2 Cluster issuers should be True)

STEP 7 : Install Rancher

- kubectl create namespace cattle-system

helm upgrade --install rancher rancher-latest/rancher \
--namespace cattle-system \
--set hostname=<LOAD_BALANCER_DNS> \
--set 'ingress.extraAnnotations.cert-manager\.io/cluster-issuer=letsencrypt-prod' \
--set ingress.ingressClassName=nginx \
--set ingress.tls.source=secret \
--set ingress.tls.secretName=rancher-tls \
--set replicas=2 \
--version $RANCHER_VERSION**
Enter fullscreen mode Exit fullscreen mode

  • Check the status of installation & wait for it to complete.
kubectl -n cattle-system rollout status deploy/rancher

kubectl get secret - namespace cattle-system bootstrap-secret -o go-template='{{ .data.bootstrapPassword|base64decode}}{{ "\n" }}'
Enter fullscreen mode Exit fullscreen mode

STEP 8 : Accessing the Rancher UI

  • Copy Load balancer DNS URL & Paste on browser for Initial setup of Rancher.

  • You will be asked for password ( copied earlier )

  • Hit Log in with Local User.

  • Define the admin password, check the box and click on “Continue”. (store it)

  • Finally, Rancher is running and you can explore “local” cluster.

STEP 9 : Check AWS EKS Console

STEP 10 : Decommission

  • Run below command to destroy all resources.
kubectl delete ns cert-manager

kubectl delete ns ingress-nginx

terraform destroy --auto-approve
Enter fullscreen mode Exit fullscreen mode

Congrats ! We have successfully completed lab for Deploying Rancher on AWS EKS using Terraform & Helm Charts.

I am Kunal Shah, AWS Certified Solutions Architect, helping clients to achieve optimal solutions on the Cloud. Cloud Enabler by choice, DevOps Practitioner having 8+ Years of overall experience in the IT industry.

I love to talk about Cloud Technology, DevOps, Digital Transformation, Analytics, Infrastructure, Dev Tools, Operational efficiency, Serverless, Cost Optimization, Cloud Networking & Security.

aws #community #builders #devops #eks #managed #kubernetes #solution #rancher #solution #management #centralize #dashboard #easy #management #scalability #operational #efficiency #robust #infrastructure #highly #available #reliable #controlled #design #acloudguy

You can reach out to me @

Top comments (0)