How to install minikube on Amazon EC2

ยท

2 min read

Minikube is local Kubernetes which makes it easy for us to learn and develop for Kubernetes.

For Minikube we need

  • 2 CPUs or more

  • 2GB of free memory

  • 20GB of free disk space

  • Internet connection

  • Container or virtual machine manager, such as Docker, QEMU, Hyperkit, Hyper-V, KVM, Parallels, Podman, VirtualBox, or VMware Fusion/Workstation. For this example, we will use docker.

Let's first start by creating an ec2 instance:

To launch an ec2 instance, log in to your AWS Console, go to EC2 > Instances > Launch an instance

Choose the key pair you always use to create a new key pair, just download the new key pair we will use it to ssh into our instance.

We can leave the rest of the configurations as default and proceed, Let's Launch the instance.

Now, We have our instance running:

Let's connect to our instance using ssh:

Lets upgrade the system packages:

sudo apt-get update && sudo apt-get upgrade -y

If you get the below confirmation during installation, hit OK!

If all the package are upgraded, lets first install docker:

curl -fsSL https://get.docker.com -o get-docker.sh && sudo sh ./get-docker.sh

Check if docker has been installed successfully:

docker -v

if docker has been installed it's time to get to the main thing now, our beloved minikube

Lets install minikube by running:

curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube

If everything goes fine, lets start minikube:

minikube start

Hopefully you will get the following error, error is because current user if not in docker group.

Add the user to docker group by running:

sudo usermod -aG docker $USER && newgrp docker

Lets try again:

minikube start

Whoa! Minikube is running ๐ŸŽ‰

Let's install kubectl to interact with the cluster:

sudo snap install kubectl --classic

Let's interact with the cluster to check if Minikube is installed successfully or not:

kubectl get po -A

This completes our installation of minikube on ec2, don't forget to leave a โ™ฅ if you got your minikube up and running.

Thank you!