Kubernetes
11%
Course progress
1 of 18 topics done
Keep going, you are close!
2 topics in a row
1 of 18 topics done
LessonΒ·2 of 18

Cluster Setup

N/A18 lessons
1

minikube

🐳 Minikube Setup Guide

MinikubeLocal ClusterDevelopmentLearningLevelDuration

πŸ“‹ Overview

🎯 Set Up Kubernetes Locally with Minikube

This guide walks you through setting up a single-node Kubernetes cluster using Minikube, ideal for development and learning purposes.

πŸ” What This Guide Covers

  • 🐳 What is Minikube - Local Kubernetes cluster
  • πŸͺŸ Windows Installation - Step-by-step setup
  • 🐧 Linux Installation - Ubuntu/Debian setup
  • πŸ”§ Configuration - Minikube settings
  • πŸš€ Starting Cluster - Launch Minikube
  • πŸ“Š Dashboard - Kubernetes dashboard access
  • βœ… Verification - Test your setup

🐳 What is Minikube?

DefinitionFundamentals

Minikube allows you to set up a Kubernetes cluster within a single VM. It's ideal for environments with limited resources, primarily used by developers or for learning purposes.

✨ Key Characteristics

  • Single Node: Runs entire cluster in one VM
  • Lightweight: Minimal resource requirements
  • Easy Setup: Simple installation and configuration
  • Development Friendly: Perfect for local development
  • Learning Tool: Great for learning Kubernetes
  • Not for Production: Not recommended for production use

πŸ“Š Use Cases

  • Development: Local development environment
  • Testing: Test applications before deployment
  • Learning: Learn Kubernetes concepts
  • Prototyping: Quick prototyping and experimentation
  • CI/CD: Local testing in CI/CD pipelines

πŸͺŸ Minikube Installation on Windows

Windows InstallationSetup Process

πŸ“‹ Prerequisites

Virtualization Check

Ensure virtualization is enabled on your system:

powershell
systeminfo

Look for the following output to confirm virtualization support:

text
Hyper-V Requirements: 
    VM Monitor Mode Extensions: Yes
    Virtualization Enabled In Firmware: Yes
    Second Level Address Translation: Yes
    Data Execution Prevention Available: Yes

Required Software

  • VirtualBox: Download from virtualbox.org
  • Hyper-V: Alternative to VirtualBox (built-in on Windows Pro/Enterprise)
  • Administrator Access: Required for installation

Step 1️⃣: Download kubectl

Download the latest release of kubectl:

powershell
curl -LO "https://dl.k8s.io/release/v1.32.0/bin/windows/amd64/kubectl.exe"

Step 2️⃣: Download Minikube

Download the latest release of Minikube:

powershell
curl -Lo minikube.exe https://github.com/kubernetes/minikube/releases/latest/download/minikube-windows-amd64.exe

Step 3️⃣: Create Minikube Directory

Create a directory and move Minikube to the C drive:

powershell
New-Item -Path "C:\" -Name "minikube" -ItemType "directory" -Force
Move-Item .\minikube.exe C:\minikube\minikube.exe -Force

Step 4️⃣: Set Up Environment Variables

Add Minikube and kubectl to your PATH:

  1. Open System Properties β†’ Environment Variables
  2. Add C:\minikube to PATH
  3. Add kubectl location to PATH
  4. Restart PowerShell

Step 5️⃣: Start Minikube

Run the following command to start Minikube:

powershell
minikube start

This will:

  • Launch a VM in VirtualBox
  • Install Kubernetes inside the VM
  • Configure kubectl to connect to the cluster

Step 6️⃣: Verify Installation

Verify Minikube is running:

powershell
kubectl get pods

🐧 Minikube Installation on Linux

Linux InstallationUbuntu/Debian

Step 1️⃣: Install VirtualBox

bash
sudo apt-get update
sudo apt-get install -y virtualbox

Step 2️⃣: Download kubectl

bash
curl -LO "https://dl.k8s.io/release/v1.32.0/bin/linux/amd64/kubectl"
chmod +x kubectl
sudo mv kubectl /usr/local/bin/

Step 3️⃣: Download Minikube

bash
curl -Lo minikube https://github.com/kubernetes/minikube/releases/latest/download/minikube-linux-amd64
chmod +x minikube
sudo mv minikube /usr/local/bin/

Step 4️⃣: Start Minikube

bash
minikube start

Step 5️⃣: Verify Installation

bash
kubectl get pods

πŸ”§ Minikube Configuration

ConfigurationSettings

Common Minikube Commands

CommandPurpose
minikube startStart Minikube cluster
minikube stopStop Minikube cluster
minikube deleteDelete Minikube cluster
minikube statusCheck cluster status
minikube dashboardOpen Kubernetes dashboard
minikube sshSSH into Minikube VM
minikube logsView Minikube logs

Start with Custom Configuration

bash
# Specify memory
minikube start --memory=4096

# Specify CPU cores
minikube start --cpus=4

# Specify driver (virtualbox, hyperv, docker)
minikube start --driver=virtualbox

# Specify Kubernetes version
minikube start --kubernetes-version=v1.32.0

πŸ’» Accessing Minikube Cluster

AccessConnection

SSH into Minikube VM

On Windows (using PuTTY)

  1. Get Minikube IP:
powershell
minikube ip
  1. Use PuTTY to connect:
    • Host: <minikube-ip>
    • Username: docker
    • Password: tcuser

On Linux/macOS

bash
minikube ssh

Access Kubernetes API

bash
# Get cluster info
kubectl cluster-info

# Get nodes
kubectl get nodes

# Get all resources
kubectl get all

πŸ“Š Launching Kubernetes Dashboard

DashboardManagement

Open Dashboard

bash
minikube dashboard

This command:

  • Launches the Kubernetes dashboard
  • Opens it in your default browser
  • Displays all cluster resources

Dashboard Features

  • Pods: View and manage pods
  • Deployments: Create and manage deployments
  • Services: View services and endpoints
  • Namespaces: Switch between namespaces
  • Logs: View container logs
  • Terminal: Execute commands in containers

βœ… Verification Checklist

VerificationTesting

After installation, verify everything is working:

bash
# Check Minikube status
minikube status

# Check cluster info
kubectl cluster-info

# Check nodes
kubectl get nodes

# Check pods in all namespaces
kubectl get pods --all-namespaces

# Check services
kubectl get services

Expected Output

text
$ minikube status
minikube
type: Control Plane
host: Running
kubelet: Running
apiserver: Running
kubeconfig: Configured

$ kubectl get nodes
NAME       STATUS   ROLES           AGE   VERSION
minikube   Ready    control-plane   5m    v1.32.0

πŸš€ Deploy Your First Application

First AppDeployment

Create a Simple Deployment

bash
# Create a deployment
kubectl create deployment hello-minikube --image=kicbase/echo-server:1.0

# Expose the deployment
kubectl expose deployment hello-minikube --type=NodePort --port=8080

# Get service info
kubectl get service hello-minikube

# Access the service
minikube service hello-minikube

πŸ› οΈ Troubleshooting

TroubleshootingIssues

Issue: Minikube fails to start

Solution:

bash
# Check logs
minikube logs

# Delete and restart
minikube delete
minikube start

Issue: kubectl cannot connect

Solution:

bash
# Check kubeconfig
kubectl config view

# Reset kubeconfig
minikube update-context

Issue: Insufficient resources

Solution:

bash
# Allocate more resources
minikube delete
minikube start --memory=4096 --cpus=4

βœ… Best Practices

Best PracticesStandards
  • Stop When Not Using: Stop Minikube to save resources
  • Regular Updates: Keep Minikube and Kubernetes updated
  • Backup Configuration: Backup kubeconfig files
  • Use Namespaces: Organize resources with namespaces
  • Monitor Resources: Monitor CPU and memory usage
  • Clean Up: Delete unused resources regularly
  • Document Setup: Document your Minikube configuration
  • Test Before Production: Always test in Minikube first

πŸ”— Navigation

Navigation

⬅️ Previous: Kubernetes Installation

πŸ“ Current Location: Minikube Setup (You are here)

➑️ Next Step: Cluster Setup

πŸ—ΊοΈ Full Path: Installation β†’ Minikube β†’ Cluster Setup β†’ Pods


πŸ“š Additional Resources

ResourcesDocumentation

Minikube Setup Complete

πŸŽ‰ Excellent! Minikube Setup Complete! πŸŽ‰

➑️ Continue to Cluster Setup