Page cover

Minikube Getting Started Guide

This guide explains Kubernetes and Minikube from absolute zero. No prior knowledge required.

Part 1: What Problem Does Kubernetes Solve?

Before learning the tools, you need to understand WHY Kubernetes exists.

The Old Way: One Application, One Server

Imagine you have a web application. In the old days, you would:

  1. Buy or rent a physical server

  2. Install the operating system

  3. Install your application

  4. If traffic increases, buy a BIGGER server (expensive!)

  5. If the server crashes, your application is DOWN until you fix it

Problems:

  • Wasted resources (server runs at 10% capacity most of the time)

  • Scaling is slow and expensive

  • Single point of failure

The Container Way: Package Everything Together

Docker solved part of this problem. Instead of installing applications directly on servers, you package them into containers.

A container is like a shipping container - it contains everything your application needs to run, packaged together. You can move it anywhere and it works the same way.

But containers alone don't solve everything:

  • How do you run 100 containers across 10 servers?

  • What happens when a container crashes?

  • How do containers find each other on the network?

  • How do you update containers without downtime?

Enter Kubernetes: The Container Orchestrator

Kubernetes is an orchestrator - it manages containers at scale. Think of it as an automated system administrator that:

  • Decides which server should run which container

  • Restarts containers that crash

  • Scales up/down based on traffic

  • Routes network traffic to the right containers

  • Rolls out updates without downtime

Analogy: If containers are musicians, Kubernetes is the conductor of the orchestra.

Part 2: Kubernetes Core Concepts (The Vocabulary)

Before touching any tools, you MUST understand these terms. Every Kubernetes tutorial assumes you know them.

Cluster

A cluster is a group of computers (servers) working together as one system.

When you deploy to Kubernetes, you deploy to "the cluster" - you don't care which specific server runs your app. Kubernetes decides that for you.

Minikube creates a cluster with just ONE server (your laptop). In production, clusters have many servers.

Node

A node is a single server (computer) in the cluster. It can be:

  • A physical machine in a data center

  • A virtual machine in the cloud (like an Azure VM)

  • A container on your laptop (how Minikube works)

Types of nodes:

Node Type
What it does

Control Plane (Master)

The "brain" - makes decisions, stores cluster state

Worker Node

Runs your actual applications

In Minikube, both roles run on the same node (your laptop).

Pod

A pod is the smallest deployable unit in Kubernetes. It's a wrapper around one or more containers.

Why not just use containers directly?

  • Pods provide a shared network namespace (containers in the same pod share an IP address)

  • Pods can share storage volumes

  • Pods allow "sidecar" patterns (helper containers next to your main app)

In practice: Most pods contain just ONE container. Think of a pod as "a running instance of your application."

circle-exclamation

Deployment

A deployment tells Kubernetes: "I want X copies of this application running at all times."

If one pod crashes, the deployment automatically creates a new one to maintain the count.

Deployment vs Pod:

Concept
What it is
Analogy

Pod

One running instance

One employee

Deployment

Desired state ("keep 3 running")

HR policy ("always have 3 people in this role")

You almost never create pods directly. You create deployments, and Kubernetes creates the pods.

Service

Problem: Pods are temporary and get new IP addresses when recreated. How do other applications find them?

Solution: A service is a stable network endpoint that routes traffic to pods.

The service has a stable IP/name. Even if pods die and get replaced (with new IPs), the service keeps working.

Types of services:

Type
What it does
Use case

ClusterIP

Only accessible inside the cluster

Backend services, databases

NodePort

Exposes on a port on every node

Development, testing

LoadBalancer

Gets a public IP from cloud provider

Production web apps

Namespace

A namespace is a way to organize resources in a cluster. Think of it like folders on your computer.

Namespaces let you:

  • Organize resources by team, project, or environment

  • Apply different permissions to different namespaces

  • Set resource limits per namespace

For learning with Minikube: You'll use the default namespace. You don't need to think about this much yet.

Container Image

A container image is a packaged application - the "recipe" for creating containers.

Images are stored in registries like:

When you tell Kubernetes to run an application, you specify the image name (e.g., nginx:1.24), and Kubernetes downloads it and runs it.

Putting It All Together

Here's how all these pieces connect:

Part 3: What is Minikube?

Now that you understand Kubernetes concepts, we can talk about Minikube.

Problem: Setting up a real Kubernetes cluster requires multiple servers, networking, and complex configuration. Not practical for learning.

Solution: Minikube creates a single-node Kubernetes cluster on your laptop.

Everything you learn on Minikube works exactly the same on real clusters. The only difference is scale.

Part 4: Installation

Step 4.1: Install Minikube

macOS (with Homebrew):

Windows (with Chocolatey):

Linux (binary download):

Step 4.2: Verify Installation

You should see something like: minikube version: v1.32.0

Part 5: Understanding kubectl and Minikube

This is where most confusion happens. Let me explain clearly.

What Are These Two Tools?

Tool
What it does

minikube

Creates and runs a local Kubernetes cluster on your laptop

kubectl

Communicates with ANY Kubernetes cluster (local or cloud)

Think of it like this:

  • minikube = The Kubernetes cluster itself (the server)

  • kubectl = The remote control to talk to the cluster (the client)

For the cleanest experience with no confusion later, install both tools separately:

macOS:

Windows:

Linux:

Verify both are installed:

Why Install Both? Why Not Just Use the Alias?

You might see guides suggesting this alias:

Don't do this. Here's why:

Problem
What happens

You connect to Azure AKS later

The alias still runs minikube kubectl -- instead of real kubectl

You uninstall minikube

All your kubectl commands break

Version mismatch

Minikube's built-in kubectl may be older than what the cloud requires

Confusion

You forget the alias exists and wonder why things behave strangely

The alias is a shortcut that creates problems later. Just install both tools and avoid the confusion.

How kubectl Knows Which Cluster to Talk To

When you run kubectl get pods, how does kubectl know whether to talk to Minikube or Azure?

The answer is the kubeconfig file at ~/.kube/config. This file stores:

  • List of clusters you can connect to

  • Credentials for each cluster

  • Which cluster is currently "active"

When you run minikube start, Minikube automatically:

  1. Creates the cluster

  2. Adds it to your ~/.kube/config

  3. Sets it as the active cluster

So after minikube start, any kubectl command automatically goes to Minikube.

Later, when you connect to Azure AKS:

This adds AKS to your config and makes it active. Now kubectl commands go to Azure.

To switch between clusters:

What About "minikube kubectl --"?

Yes, Minikube has kubectl built-in. You CAN use it like this:

When would you use this?

  • If you absolutely cannot install kubectl separately

  • For quick testing when kubectl isn't installed

But for normal use: Just install kubectl separately. It's cleaner.

Summary: The Right Setup

No aliases. No confusion. This works with Minikube today and with Azure/AWS/GCP tomorrow.

Part 6: Starting and Stopping Minikube

Step 3.1: Start Your Cluster

This creates a virtual machine (or container) and installs Kubernetes inside it. First run takes 2-5 minutes.

You should see output like:

Step 3.2: Check Cluster Status

Expected output:

Step 3.3: Stop Your Cluster (saves resources)

This shuts down the VM but preserves your data. You can start it again later.

Step 3.4: Delete Your Cluster (complete reset)

This removes everything. Use this if something is broken and you want to start fresh.

Part 7: Essential Navigation Commands

Every kubectl command follows this pattern:

Part
Examples

action

get, describe, delete, create, apply, logs, exec

resource-type

pods, services, deployments, nodes

name

(optional) specific resource name

flags

-o wide, -n namespace, -f filename

kubectl get - List Resources

Lists resources in your cluster.

Common flags:

Flag
What it does

-o wide

Show more columns (IPs, nodes)

-n kube-system

Look in specific namespace

-A

Look in ALL namespaces

-w

Watch for changes (live updates)

Understanding the output:

Column
Meaning

NAME

Pod's name (auto-generated from deployment + random suffix)

READY

Ready containers / Total (1/1 means 1 container, it's ready)

STATUS

Running, Pending, Error, CrashLoopBackOff, etc.

RESTARTS

How many times the container crashed and restarted

AGE

Time since pod was created

kubectl describe - Get Details

Shows detailed information about a resource. Use when debugging.

The output includes configuration, status, and Events - the Events section tells you why something failed.

kubectl logs - View Container Output

Shows what the application is printing (stdout/stderr).

Press Ctrl+C to stop following logs.

kubectl exec - Run Commands Inside Container

Run commands inside a running container. Like SSH for containers.

The -- is important - it separates kubectl flags from the command to run inside.

The -it flags:

  • -i = interactive (keep stdin open so you can type)

  • -t = tty (allocate a terminal so you get a proper prompt)

Type exit to leave the container.

kubectl delete - Remove Resources

Note: If you delete a pod created by a deployment, Kubernetes immediately creates a replacement. Delete the deployment to permanently remove.

kubectl create - Create Resources

This creates a deployment named "nginx" using the nginx:1.24 container image.

kubectl apply - Create or Update from File

Difference from create:

Command
If already exists
If doesn't exist

kubectl create

ERROR

Creates it

kubectl apply

Updates it

Creates it

Use apply - it's safer.

Quick Reference

Goal
Command

List pods

kubectl get pods

List pods with IPs

kubectl get pods -o wide

List services

kubectl get svc

List everything

kubectl get all

Pod details

kubectl describe pod <name>

View logs

kubectl logs <pod>

Follow logs

kubectl logs -f <pod>

Shell into container

kubectl exec -it <pod> -- /bin/sh

Delete pod

kubectl delete pod <name>

Delete deployment

kubectl delete deployment <name>

Apply YAML

kubectl apply -f <file.yaml>

Part 8: Namespaces - Organizing Your Cluster

Namespaces are like folders for organizing resources. Minikube has these by default:

Output:

Namespace
Purpose

default

Where your applications go (unless you specify otherwise)

kube-system

Kubernetes internal components (don't touch)

kube-public

Publicly readable data (rarely used)

kube-node-lease

Node heartbeat data (internal)

Working with Namespaces

Part 9: Minikube-Specific Features

Accessing Services (LoadBalancer)

In cloud Kubernetes, LoadBalancer services get public IPs. Minikube can't do this, so use:

Minikube Dashboard (Visual Interface)

This opens a web-based UI where you can see all resources visually.

Enabling Add-ons

Minikube has optional features you can enable:

SSH into Minikube VM

This gives you a shell inside the Minikube virtual machine.

Part 10: Your First Deployment

Let's deploy a simple application to verify everything works.

Step 10.1: Create a Deployment

Step 10.2: Check the Deployment

Wait until the pod shows STATUS: Running.

Step 10.3: Expose as a Service

Step 10.4: Access the Service

Your browser should open showing the application.

Step 10.5: Clean Up

Part 11: Common Issues and Solutions

Issue: "minikube start" hangs or fails

Issue: kubectl commands fail with connection error

Issue: Not enough resources

Part 12: Quick Reference Card

Command
What it does

minikube start

Start the cluster

minikube stop

Stop (preserve data)

minikube delete

Delete everything

minikube status

Check if running

minikube dashboard

Open web UI

minikube service <name>

Access a service

minikube ssh

Shell into VM

kubectl get pods

List pods

kubectl get services

List services

kubectl get all

List everything

kubectl describe <type> <name>

Detailed info

kubectl logs <pod>

View pod logs

kubectl exec -it <pod> -- sh

Shell into pod

kubectl apply -f file.yaml

Deploy from file

kubectl delete -f file.yaml

Remove from file

Summary: The Mental Model

Think of it like this:

  • Minikube = Virtual machine containing Kubernetes

  • kubectl = Remote control that talks to Kubernetes API

  • Pods = Your running containers

  • Services = Network access to your pods

You're now ready to explore Kubernetes!

Last updated