As cloud-native technologies evolve, organizations increasingly turn to solutions like Rancher and Amazon EKS to manage Kubernetes clusters efficiently. This comprehensive guide explores the step-by-step process of deploying Rancher on Ubuntu using Terraform and managing EKS clusters in AWS through Rancher, AWS Console, and Excel.

Setting Up the Environment for Rancher Deployment

Before deploying Rancher, ensure you have a properly configured environment:

  1. Install Prerequisites:
    • Install Ubuntu 22.04 or a compatible version on your server.
    • Install Docker, as Rancher runs as a containerized application:
      sudo apt update

sudo apt install -y docker.io

Install Terraform:
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add –

sudo apt-add-repository “deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main”

sudo apt update && sudo apt install terraform

  1. Prepare the System:
    • Configure firewalls to allow HTTP (80) and HTTPS (443) traffic.
    • Ensure a static IP is assigned to the server.
  2. Set Up DNS:
    • Point a domain or subdomain to the server’s IP for Rancher access.

Configuring AWS Infrastructure Using Terraform

Terraform simplifies the creation of AWS infrastructure. Here’s how to set up the environment for Rancher and EKS:

  1. Define the VPC and Subnets: Create a main.tf file to define the AWS VPC and subnets:
    provider “aws” {

  region = “us-east-1”

}

resource “aws_vpc” “main” {

  cidr_block = “10.0.0.0/16”

}

resource “aws_subnet” “subnet1” {

  vpc_id     = aws_vpc.main.id

  cidr_block = “10.0.1.0/24”

}

  1. Provision EC2 Instances: Add resources for an EC2 instance where Rancher will be deployed.
  2. Execute Terraform Commands: Initialize Terraform and apply the configuration:
    terraform init

terraform apply

Deploying Rancher on Ubuntu

After configuring the infrastructure, deploy Rancher:

  1. Run the Rancher Docker Container:
    docker run -d –restart=unless-stopped \

  -p 80:80 -p 443:443 \

  –name rancher \

  rancher/rancher:latest

  1. Access Rancher UI: Navigate to https://your-domain in a browser to complete the Rancher setup.
  2. Configure Admin Access: Set up an admin user and configure authentication options.

Creating EKS Clusters with Rancher, AWS Console, and eksctl

Using Rancher

  1. In Rancher UI, navigate to Cluster Management.
  2. Select Create Cluster, choose Amazon EKS, and provide the required configurations.
  3. Rancher will handle cluster provisioning and authentication.

Using AWS Console

  1. Open the Amazon EKS console and click Create Cluster.
  2. Specify the cluster name, Kubernetes version, and networking details.
  3. Launch and associate worker nodes with the cluster.

Using eksctl

  1. Install eksctl:
    brew tap weaveworks/tap

brew install weaveworks/tap/eksctl

  1. Create an EKS cluster:
    eksctl create cluster –name my-cluster –region us-east-1

Managing EKS Clusters in Rancher

Rancher simplifies EKS cluster management through its intuitive interface:

  1. Connect EKS Clusters:
    • Import existing EKS clusters into Rancher.
    • Navigate to Cluster ManagementImport Existing Cluster.
  2. Monitor and Manage Clusters:
    • Use Rancher’s built-in monitoring tools for resource utilization.
    • Apply policies and RBAC for secure access control.
  3. Deploy Applications:
    • Leverage Helm charts and Rancher’s catalog to deploy workloads seamlessly.

Conclusion

Deploying Rancher on Ubuntu using Terraform and managing EKS clusters with Rancher, AWS Console, and eksctl is a powerful way to streamline Kubernetes management. Integrating these tools allows you to automate infrastructure provisioning, simplify cluster management, and boost operational efficiency.

References

Managing Amazon EKS Clusters with Rancher

Introducing Amazon EKS Distro (EKS-D)