LinuxCommandLibrary

minikube

Run a single-node Kubernetes cluster locally

TLDR

Start the cluster

$ minikube start
copy

Get the IP address of the cluster
$ minikube ip
copy

Access a service named my_service exposed via a node port and get the URL
$ minikube service [my_service] --url
copy

Open the Kubernetes dashboard in a browser
$ minikube dashboard
copy

Stop the running cluster
$ minikube stop
copy

Delete the cluster
$ minikube delete
copy

Connect to LoadBalancer services
$ minikube tunnel
copy

SYNOPSIS

minikube <command> [<flags>]
minikube start [<flags>]

PARAMETERS

--driver <name>
    Specifies the VM driver or container runtime to use (e.g., docker, virtualbox, kvm2). The default is often chosen based on detected system capabilities.

--memory <amount>
    Sets the amount of RAM (in megabytes) allocated to the minikube VM (e.g., 4096mb). A restart of minikube is required for changes to take effect.

--cpus <count>
    Defines the number of CPUs allocated to the minikube VM (e.g., 2). Requires a minikube restart to apply changes.

--kubernetes-version <version>
    Selects the specific Kubernetes version to use (e.g., v1.28.0). Useful for testing applications against different Kubernetes releases.

--profile <name>
    Specifies the name of the minikube profile. This allows running multiple independent minikube clusters concurrently on the same machine.

--container-runtime <runtime>
    Determines the container runtime to be used within the Kubernetes cluster (e.g., containerd, docker).

DESCRIPTION

minikube is an open-source tool designed to simplify the process of running a single-node Kubernetes cluster directly on your personal computer. It accomplishes this by typically provisioning a lightweight virtual machine (VM) or a container (like Docker) on your local machine, within which a complete Kubernetes environment operates.

This setup provides a sandboxed, fully functional Kubernetes cluster ideal for local development, testing, and learning without the complexities of cloud-based or multi-node installations. minikube seamlessly integrates with the standard kubectl command-line tool, automatically configuring it to interact with the local cluster.

Key capabilities include support for various VM drivers and container runtimes (e.g., VirtualBox, KVM, Docker, Hyper-V), built-in management for common Kubernetes addons (like the Dashboard or Ingress controller), efficient local image caching, and the ability to mount host-path volumes, making it an essential utility for developers working with Kubernetes.

CAVEATS

While highly convenient, minikube can be resource-intensive, requiring sufficient CPU and RAM, especially for demanding workloads or when running multiple profiles. It relies on an underlying hypervisor or container runtime, which must be correctly installed and configured. minikube is designed for local development and testing environments and is not suitable for production deployments. Users may occasionally encounter network configuration challenges that require manual troubleshooting of the underlying VM or container networking.

ADDON MANAGEMENT

minikube features a robust addon manager that allows users to effortlessly enable or disable popular Kubernetes components, such as the Kubernetes Dashboard, Ingress controllers, container registries, and more. This significantly streamlines the process of integrating common development tools into the local cluster.
Example usage: minikube addons enable dashboard

KUBECTL INTEGRATION

Upon successful startup, minikube automatically configures the local kubectl command-line tool to point to its cluster. It intelligently manages Kubernetes contexts, ensuring that subsequent kubectl commands are directed to the minikube cluster without requiring manual context switching by the user, providing a highly integrated experience.

HISTORY

Developed by Google, minikube was first released in 2016 to simplify the previously complex task of setting up a local Kubernetes development environment. Its initial goal was to provide a straightforward, consistent way for developers to run Kubernetes on their workstations. Over the years, it has continuously evolved, incorporating support for a wide range of drivers, newer Kubernetes versions, and essential features like addon management, solidifying its role as a fundamental tool in the Kubernetes ecosystem.

SEE ALSO

kubectl(1), docker(1), kind(1), microk8s(1)

Copied to clipboard