DEV Community

Vinoth Mohan
Vinoth Mohan

Posted on

Setting up Minikube in EC2 - The Easy Way

Minikube is a tool that lets you run a single-node Kubernetes cluster on your personal computer or in EC2 instance so that you can try out Kubernetes.

Step 1 : Launch an EC2 Instance using the following configuration.

  • AMI : Ubuntu Server 20.04 LTS (HVM), (64-bit x86)
  • Instance Type : t2.medium
  • Configure Instance Details :
    • In this section scroll to the bottom, there you will find user data field, Copy this script and paste it in that field
#!bin/bash
sudo apt update
sudo apt upgrade -y
sudo hostnamectl set-hostname minikube
sudo apt-get install -y apt-transport-https ca-certificates curl
sudo apt-get update -y &&  sudo apt-get install -y docker.io
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
snap install kubectl --classic
sudo apt install conntrack -y
Enter fullscreen mode Exit fullscreen mode
  • Add Storage : 10GiB
  • Add Tags :
    • Key : Name
    • Value : minikube
  • Security Group : Create a New Security Group
    • Type : All Traffic
    • Source : My IP (or) Leave it as 0.0.0.0/0
  • Review and Launch : Select or Create a new key pair
    • Launch

Step 2 : SSH into your EC2 instance

$ ssh -i [keypair] ubuntu@[Instance Public IP]
Enter fullscreen mode Exit fullscreen mode

Step 3 : Verify

As we already bootstrapped the all necessary installation, Only thing that we need to do is to verify the installed Minikube by checking the version.

$ minikube version
Enter fullscreen mode Exit fullscreen mode

Step 4 : Start running Minikube

  • Become a root user
$ sudo -i
Enter fullscreen mode Exit fullscreen mode
  • Start the minikube
$ minikube start --vm-driver=none
Enter fullscreen mode Exit fullscreen mode
  • Check Status
$ minikube status
Enter fullscreen mode Exit fullscreen mode

Thats it!!! Minikube is now running your EC2 instance !.
You can play with kubernetes using this single node kubernetes cluster.

Top comments (1)

Collapse
 
nafiudanlawal profile image
nafiudanlawal • Edited

Sorry Vinoth but you skipped a lot of steps especially for installing minikube on ec2.

This how to is a bit more comprehesive.