How to Create a Kubernetes Cluster in AWS using Vishwakarma

May 25, 2022 | Programming

Setting up a Kubernetes cluster can feel like assembling a complex piece of furniture without the manual. Luckily, Vishwakarma makes this process a breeze by leveraging HashiCorp Terraform and CoreOS. Let’s take a delightful journey through the setup process while navigating any bumps along the road!

What You Need Before Starting

Before you operate Vishwakarma, ensure you have the following tools and setups:

  • Terraform: Download and install Terraform. Ensure you have a minimum version of v1.2.0.
  • kubectl: Install kubectl to manage Kubernetes resources, with a minimum version of v1.31.0.
  • aws-iam-authenticator: This tool integrates with AWS IAM for access. Follow this guide to install it.
  • Key Pair: Create a key pair in AWS EC2 for SSH access.
  • jq: A command-line utility for JSON processing.
  • Python: Version 3.7 and pip are required for node rolling updates.

Getting Started with Vishwakarma

Let’s clone the Vishwakarma repository from GitHub and configure our AWS EC2 key pairs.

sh
# Clone the Vishwakarma repo
git clone https://github.com/getamis/vishwakarma.git

Before you begin, create an AWS EC2 key pair and provide it when prompted:

sh
# Input the key pair name when prompted
var.key_pair_name = The key pair name for access bastion ec2
Enter a value:

Creating the Kubernetes Cluster

To create the cluster, follow these steps:

  1. Change to the Kubernetes cluster example folder:
  2. sh
    cd examples/kubernetes-cluster
    
  3. Initialize Terraform module and install provider plugins:
  4. sh
    terraform init
    
  5. Create the network infrastructure:
  6. sh
    terraform apply -target=module.network
    
  7. Create the Kubernetes master component:
  8. sh
    terraform apply -target=module.master
    
  9. Set up the general and spot Kubernetes worker groups:
  10. sh
    terraform apply
    

Once these steps are completed, verify if the Kubernetes cluster is up:

sh
# Get the kubeconfig from S3
export KUBECONFIG=/Path/You/Put/kubeconfig
# Check if the workers are registered successfully
kubectl get nodes

Understanding the Modules

Vishwakarma comprises several modules that work harmoniously together, similar to a well-oiled machine:

  • awsnetwork: Creates a public and private subnet set within an AWS VPC.
  • awselastikube: Sets up the Kubernetes control plane with Terraform handling complex components.
  • awskube-worker: Establishes an auto-scaling group of CoreOS instances using AWS launch templates.

Troubleshooting Tips

If you encounter issues during the setup, here are a few troubleshooting tips:

  • Ensure all required versions of tools are installed correctly.
  • Verify your AWS permissions for Terraform are appropriately set up.
  • If connection issues arise, check your key pair configurations and security group settings.

For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

Final Thoughts

Setting up a Kubernetes cluster using Vishwakarma is an exhilarating experience that can be utterly rewarding! Remember to explore each module’s documentation for further customizations.

At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox