Introduction to Minikube
Minikube is a tool that allows you to run a single-node Kubernetes cluster on your local machine, ideal for developers and administrators who want to test applications without needing cloud infrastructure. In Linux environments, its integration is seamless because it leverages the kernel and native system containers. This post will guide you step by step from installation to deploying your first application, using only the command line and standard packages from most distributions.
Prerequisites
Before you begin, make sure you have a recent Linux distribution (Ubuntu 22.04, Fedora 38 or similar) with sudo access. You’ll need a compatible hypervisor; Minikube supports Docker, VirtualBox, and KVM2, with Docker being the simplest option if you already have it installed. It’s also useful to have curl and wget for downloading binaries, and to have virtualization enabled in the BIOS (VT‑x/AMD‑v). Verify that your user belongs to the docker group to avoid using sudo each time you run containers.
Installing Dependencies
First install Docker, which will be the default driver for Minikube. On Ubuntu you can run sudo apt update && sudo apt install -y docker.io and then sudo systemctl enable --now docker. On Fedora use sudo dnf install -y docker and sudo systemctl enable --now docker. Add your user to the Docker group with sudo usermod -aG docker $USER and restart the session. Then install kubectl, the Kubernetes CLI: download it with curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl", make it executable, and move it to /usr/local/bin.
Downloading and Installing Minikube
Get the latest Minikube binary from its official page. Run curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64, then sudo install minikube-linux-amd64 /usr/local/bin/minikube. Verify the installation with minikube version. If you prefer using a package manager, on Ubuntu you can add the repository deb https://apt.kubernetes.io/ kubernetes-xenial main and install with apt, but the binary method ensures the most up‑to‑date version.
Starting the Cluster
With the dependencies ready, launch Minikube specifying Docker as the driver: minikube start --driver=docker. The command will download a lightweight Linux image containing the Kubernetes components (etcd, apiserver, controller manager, kubelet) and create a single node. This process may take several minutes the first time; watch the output to confirm the cluster is in the Running state. You can verify the nodes with kubectl get nodes and the dashboard with minikube dashboard.
Interacting with kubectl
Once the cluster is active, kubectl automatically points to the Minikube context. Try running kubectl get pods -A to see the system pods. Deploy a test application, for example an nginx server: kubectl create deployment nginx --image=nginx. Then expose the port with kubectl expose deployment nginx --port=80 --type=NodePort. Get the access URL with minikube service nginx --url and open it in your browser to see the default nginx page.
Full Deployment Example
To solidify your knowledge, deploy a simple web application using a YAML file. Create a file app.yaml containing a Deployment with three replicas of a container image that serves a static HTML page and a Service of type LoadBalancer (in Minikube this behaves as NodePort). Apply the manifest with kubectl apply -f app.yaml. Verify that the pods are ready with kubectl get pods -w and that the service is accessible via minikube service app --url. This flow shows how to move from command‑line instructions to infrastructure‑as‑code declarations.
Best Practices and Cleanup
When you’re done experimenting, stop the cluster to free resources: minikube stop. If you want to delete all state and start fresh, use minikube delete. Remember that persistent volumes created with hostPath persist outside the cluster; delete them manually if you don’t need them. Keep both Minikube and kubectl up to date by following