Setup Minikube on AWS EC2 Ubuntu

Setup Minikube on AWS EC2 Ubuntu

To set up Minikube on an AWS EC2 instance, you can follow these steps:

Create Ubuntu 22.04 LTS Instance

To create an Ubuntu EC2 instance on AWS, you can follow these steps:

  1. Log in to your AWS console: Log in to your AWS account and go to the EC2 service dashboard.

  2. Launch an EC2 instance: Click on the "Launch Instance" button to launch a new EC2 instance.

  3. Choose an Amazon Machine Image (AMI): In the "Choose an Amazon Machine Image (AMI)" section, select "Ubuntu" as the operating system.

  4. Choose an Instance Type: In the "Choose an Instance Type" section, select the instance type t2.medium ( 2vCPU, 4GiB memory) that meets your requirements. You can choose any instance type based on your workload needs.

  5. Create a key pair: In the "Select an existing key pair or create a new key pair" dialog box, select "Create a new key pair" and enter a name for your key pair. Click on "Download Key Pair" to download the private key file.

  6. Configure Instance Details: In the "Configure Instance Details" section, you can configure various options like VPC, subnet, IAM role, etc. as per your requirements. You can also add additional storage to your instance if needed.

  7. Configure Security Group: In the "Configure Security Group" section, you can configure the security group for your instance. You can choose to create a new security group or use an existing one.

  8. Launch Instance: Click on the "Launch Instances" button to launch your Ubuntu EC2 instance.

You can Install all this by doing the below steps one by one. and these steps are for Ubuntu AMI.

# Steps:-

# For Docker Installation
sudo apt-get update
sudo apt-get install -y
sudo usermod -aG docker $USER && newgrp docker

# For Minikube & Kubectl
curl -LO
sudo install minikube-linux-amd64 /usr/local/bin/minikube 

sudo snap install kubectl --classic
minikube start --driver=docker

test the minikube status

if everything is working fine, now create a nginx pod

ubuntu@ip-172-31-37-7:~$ kubectl run nginx --image=nginx
pod/nginx created

ubuntu@ip-172-31-37-7:~$ kubectl get pods
nginx   1/1     Running   0          23s

Note: It is important to note that running Minikube on an EC2 instance is not recommended for production workloads. Instead, you should consider running a managed Kubernetes service on AWS, such as Amazon EKS.