Spring Boot HandBook

    Installing Kubernetes Cluster using MiniKube

    Introduction#

    Setting up Kubernetes from scratch can be a real challenge, especially if you’re just starting out. There’s a lot to configure—nodes, networking, cloud integration—it can feel overwhelming pretty fast. But what if you just want to learn Kubernetes without all the hassle?

    That’s where Minikube comes in. It’s a lightweight tool that lets you run a Kubernetes cluster locally without needing multiple machines or a cloud provider. I remember the first time I tried setting up Kubernetes manually—I spent hours troubleshooting configs, only to realize I could’ve just used Minikube to get things running in minutes.

    If you’re looking for a quick and easy way to test Kubernetes, experiment with deployments, or just get comfortable with the basics, Minikube is the perfect starting point. In this guide, I’ll walk you through the installation process step by step, so you can get your own local cluster up and running without any headaches.

    Prerequisites#

    Before installing Minikube, ensure your system meets the following requirements:

    1. Operating System: Windows, macOS, or Linux
    2. RAM: At least 4GB
    3. CPU: A 64-bit processor with virtualization enabled (VT-x or AMD-V)
    4. Hypervisor: VirtualBox, Docker, Hyper-V, or KVM (for virtualization)
    5. Installed Tools:
    • Kubectl (Kubernetes CLI)
    • A supported hypervisor (VirtualBox, Docker, or Hyper-V)

    Steps to setup Minikube on your machine#

    You can visit the official documentation to see the minikube installation steps for mac, linux or windowns operating system.

    Step-1 Download Minikube installer from the official website#

    1. Visit the official documentation and download the minikube installer
    2. After downloading install minikube on your machine by running the installer.
    3. To install the latest minikube stable release on x86-64 macOS using Homebrew you can run this command : brew install minikube
    4. Ensure the minikube is accessible via the command line by running:
    minikube version

    Output:

    minikube version: v1.34.0 commit: 210b148df93a80eb872ecbeb7e35281b3c582c61

    Step-2 Start Minikube#

    Once Minikube is installed, you can start your local Kubernetes cluster with a single command:

    minikube start

    Output:

    * minikube v1.34.0 on Microsoft Windows 11 Home Single Language 10.0.26100.3194 Build 26100.3194 * Automatically selected the docker driver * Using Docker Desktop driver with root privileges * Starting "minikube" primary control-plane node in "minikube" cluster * Pulling base image v0.0.45 ... * Creating docker container (CPUs=2, Memory=3900MB) ... ! Failing to connect to <https://registry.k8s.io/> from inside the minikube container * To pull new external images, you may need to configure a proxy: <https://minikube.sigs.k8s.io/docs/reference/networking/proxy/> * Preparing Kubernetes v1.31.0 on Docker 27.2.0 ... - Generating certificates and keys ... - Booting up control plane ... - Configuring RBAC rules ... * Configuring bridge CNI (Container Networking Interface) ... * Verifying Kubernetes components... - Using image gcr.io/k8s-minikube/storage-provisioner:v5 * Enabled addons: storage-provisioner, default-storageclass * Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default

    By default, Minikube will select the best available hypervisor, but you can specify one manually. For example, to use Docker:

    minikube start --driver=docker

    Once started, Minikube will:

    ✅ Download and configure the required Kubernetes components

    ✅ Set up a single-node Kubernetes cluster

    ✅ Provide you with a ready-to-use K8s environment

    To check if the cluster is running, use:

    kubectl cluster-info

    Output:

    Kubernetes control plane is running at <https://127.0.0.1:62650> CoreDNS is running at <https://127.0.0.1:62650/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy> To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

    Note :- If kubectl is not installed in your machine visit this page and follow the steps to install kubectl on your machine. By default kubectl comes with docker desktop so you don’t need to install kubectl manually if you have docker desktop.

    kubectl (pronounced "cube control") is the command-line tool used to interact with a Kubernetes cluster. It allows you to deploy applications, inspect resources, manage configurations, and troubleshoot issues within Kubernetes.

    You can run docker ps command to see if minikube cluster is up and running

    docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES e58c7f945580 gcr.io/k8s-minikube/kicbase:v0.0.45 "/usr/local/bin/entr…" 4 minutes ago Up 4 minutes 127.0.0.1:62646->22/tcp, 127.0.0.1:62647->2376/tcp, 127.0.0.1:62649->5000/tcp, 127.0.0.1:62650->8443/tcp, 127.0.0.1:62648->32443/tcp minikube

    Now you are set to work with the kubernetes cluster on your machine.

    Step-3 Explore Minikube commands#

    Minikube Commands:#

    • minikube start – Starts a Minikube cluster, creating a single-node Kubernetes setup locally.
    • minikube stop – Stops the Minikube cluster but retains the existing configuration.
    • minikube delete – Deletes the entire Minikube cluster, removing all resources and configurations.
    • minikube status – Displays the current status of the Minikube cluster, including nodes and components.
    • minikube dashboard – Launches the Kubernetes web-based dashboard for visual management of the cluster.
    • minikube node add – Adds a new node to the Minikube cluster, useful for testing multi-node Kubernetes setups.
    • minikube node delete <node-name> – Removes a specific node from the Minikube cluster, reducing the number of nodes.

    Kubectl Commands:#

    • kubectl cluster-info – Displays basic information about the cluster, including the control plane and services.
    • kubectl get namespaces – Lists all namespaces in the cluster, helping organize resources within different environments.
    • kubectl get nodes – Shows all nodes in the cluster along with their statuses.
    • kubectl describe node <node-name> – Provides detailed information about a specific node, including resource usage and conditions.

    Conclusion#

    In this blog, we walked through the steps to install and set up Minikube, making it easy to run a Kubernetes cluster on your local machine. Setting up Kubernetes manually can be complicated, but Minikube simplifies the process, allowing you to focus on learning and experimenting rather than troubleshooting configurations. Now that your cluster is up and running, you can start experimenting with deployments, scaling applications, and understanding how Kubernetes manages containerized workloads.

    Last updated on Feb 20, 2025