Running Minikube in AWS EC2 (Ubuntu)




If you are studying Kubernetes and having a hard time running Minikube on an EC2 Instance, you are not alone. I had a hard time doing it when it was my first time.

Below are the steps (and some comments) that I took to help me run Minikube on my EC2 Instance.

Installation of Minikube on EC2 Ubuntu

1. Run a public EC2 Server with the following setup

AMI Ubuntu Server 18.04 LTS (HVM), SSD Volume Type
Instance Type t2.micro
Storage 8 GB (gp2)
Tags – Key: Name
– Value: Minikube
Security Group Name: Minikube Security Group
– SSH, 0.0.0.0/0
Later we will be editing this.
Key Pair Create your own keypair.
You will need this to SSH to your EC2 Instance

The above setup is within the AWS Free Tier so you could try Minikube on EC2 without spending money. But you can run Minikube on a bigger instance if you like.

2. SSH into your created EC2 Instance using your keypair.

3. Install kubectl

4. Install Docker

Minikube requires Docker.

5. Install Minikube

6. Check Minikube Version

We have now successfully installed Minikube!

Let’s test it!

Running Minikube on EC2 Ubuntu

Become a root user.

If you are not comfortable running commands as root, you must always add sudo before the commands minikube and kubectl.

2. Start Minikube

Do not worry about the warning. As long as you see the message ‘Kubectl is now configured to use the cluster.’ you have successfully ran Minikube.

Note: In the Install Minikube documentation from Kubernetes.io it says that you need to enable virtualization by accessing the computer’s BIOS. For EC2 Instances we do not have access to the BIOS since AWS EC2 instance is a Virtual Machine. Thus we are using the --vm-driver=none tag. No need to install a Hypervisor (VirtualBox or KVM)

3. Check the status of Minikube

If you see the status as ‘running’ then we can now run kubectl commands.

4. Let us run our first container

5. Expose the container ports so that we can access it.

6. Find where port 8080 in container exposed in EC2 Instance port.

Note: Port 30263 is the EC2 Instance Port where the Port 8080 of the container is exposed.

The EC2 Instance Port changes each time you expose a port, you may have been given a different value than what I have.

kubectl get services command shows the list of services and their exposed ports.

Let us check by accessing this via a web browser on our local computer. But first we need to edit our EC2 Security Group.

7. Edit Security Group of the EC2 Instance to be access

The goal is for us to be able to access the EC2 Instance Port (30263 for me) via the internet.




EC2 >> (Network & Security) Security Groups >> Minikube Security Group >> Ingress

Press Edit. Then Add Rule.

Add the following.

Type Custom TCP Rule
Protocol TCP
Port Range 30263 (the port given to you by the kubectl get services command)
Source Custom
0.0.0.0/0 (Accessible via the internet)

Click Save.

8. Access the our container via the EC2 Instance Port on a web browser.

The address is <ipv4_public_ip>:<ec2_port>.

My EC2 Instance has an IPv4 Public IP of 13.250.43.8. And since my hello-minikube port 8080 is exposed on port 30263, the address that I placed on my browser is 13.250.43.8:30263.

See the request_uri of the page displayed by the web browser, it says that I am accessing via port 8080.

I accessed my container deployment using Chrome on my laptop. You can use any web browser you like (Safari, Internet Explorer, Edge, Firefox, etc.)

Now that we know that we can access our container, let us finish this and clean up.

9. Delete the exposed service (port)

10. Delete the deployed container (hello-minikube)

Stopping Minikube/Shutting Down the Cluster

I hope the above helps when you want to use Minikube on EC2 Ubuntu.

If there are errors, comments, suggestions, or clarifications you can comment them below.




4 thoughts on “Running Minikube in AWS EC2 (Ubuntu)”

  1. Hi! Thank you so much for such an easy-to-follow article! It helped me to get my first minikube up and running on a free EC2 instance without any problem.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.