Table of contents
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:
Log in to your AWS console: Log in to your AWS account and go to the EC2 service dashboard.
Launch an EC2 instance: Click on the "Launch Instance" button to launch a new EC2 instance.
Choose an Amazon Machine Image (AMI): In the "Choose an Amazon Machine Image (AMI)" section, select "Ubuntu" as the operating system.
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.
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.
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.
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.
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 docker.io -y
sudo usermod -aG docker $USER && newgrp docker
# For Minikube & Kubectl
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
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
NAME READY STATUS RESTARTS AGE
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.