🚀 How to Practice Kubernetes Using Minikube on AWS EC2 (Ubuntu)

 Hello DevOps enthusiasts 👋,

Today, I’m going to share a practical way for you to start learning and practicing Kubernetes (K8s) in your local environment or cloud — specifically by using Minikube.

Whether you are using Linux, macOS, Windows, or an AWS EC2 instance, you can easily set up a single-node Kubernetes cluster using Minikube. In this blog, I’ll walk you through installing Minikube on an EC2 instance with Ubuntu OS (recommended: t2.medium).

Press enter or click to view image in full size

But before we jump into the installation, let me first explain two important concepts: how Minikube works and the idea of DIND (Docker-in-Docker).

🧠 Understanding How Minikube Works & DIND Concept

Minikube is a lightweight Kubernetes implementation that helps you run a local cluster mainly for development and testing.

When you run Minikube using the Docker driver, everything runs inside Docker containers. This includes:

  • apiserver
  • etcd
  • controller-manager
  • scheduler
  • kubelet
  • kube-proxy

Each of these components runs in separate Docker containers inside your main Docker environment. This is where the Docker-in-Docker (DIND) concept comes into play.

DIND = Docker inside Docker

In this setup, Minikube uses Docker containers to simulate the core components of a Kubernetes cluster — making it very lightweight and easy to manage.

💻 Minikube Installation Guide on EC2 (Ubuntu)

Let’s now move to the hands-on part: setting up Minikube on an EC2 instance.

✅ Prerequisites

Make sure your EC2 instance meets the following:

  • OS: Ubuntu (tested on 20.04 and 22.04)
  • Instance Type: t2.medium (2 vCPUs, 4GB RAM)
  • User: With sudo privileges
  • Virtualization Support: Check with

egrep -c '(vmx|svm)' /proc/cpuinfo

  • Output should be 1 or more.

🔧 Step-by-Step Installation

Step 1: Update System Packages

sudo apt update

Step 2: Install Required Utilities

sudo apt install -y curl wget apt-transport-https

Step 3: Install Docker

sudo apt install -y docker.io
sudo systemctl enable --now docker

Allow your current user to run Docker without sudo:

sudo usermod -aG docker $USER && newgrp docker

⚠️ After this step, logout and reconnect to your EC2 instance.

Step 4: Install Minikube

curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
chmod +x minikube
sudo mv minikube /usr/local/bin/

Step 5: Install kubectl

curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x kubectl
sudo mv kubectl /usr/local/bin/

🚀 Step 6: Start Minikube

minikube start --driver=docker --vm=true

This starts a single-node Kubernetes cluster inside Docker using DIND.

✅ Step 7: Verify the Cluster

minikube status
kubectl get nodes

If everything went well, you’ll see a Ready node, and your Kubernetes cluster is up and running! 🎉

🛑 Step 8: Stop and Clean Up

Stop the cluster:

minikube stop

Optional: Delete the cluster completely:

minikube delete

👨‍💻 Final Thoughts

Minikube is a great tool for learning Kubernetes in a simple, local, and cost-effective way. Using an EC2 instance makes it accessible from anywhere, and the DIND architecture keeps it lightweight.

Now that you’ve set up your cluster, you can:

  • Deploy sample apps
  • Practice Helm charts
  • Set up Ingress
  • Learn how to monitor clusters

Keep practicing and automating!

If you found this guide helpful, stay tuned for more DevOps content, tips, and tutorials. Happy learning! 🚀

— Raees Qazi
DevOps Engineer | Learner | Mentor | Creator

Comments

Popular posts from this blog

📘 Understanding Prometheus in a Simple Way-Part 3 (For DevOps Beginners)

Grafana Setup & Dashboard Creation (Part-5)— Explained by Raees Yaqoob Qazi

My First Python Program: A Simple Calculator