What is Minikube
Minikube is an open-source tool that allows developers to run a single-node Kubernetes cluster locally on their machine. Minikube provides a simplified way for developers to learn Kubernetes, develop and test applications, and experiment with new features in an isolated environment without the need for extensive hardware resources.
Minikube runs a single-node cluster inside a virtual machine (VM) on your personal computer. This VM contains all the necessary Kubernetes components such as the API server, the scheduler, etcd, and more. Additionally, Minikube supports various Kubernetes features like DNS, NodePorts, ConfigMaps, and Secrets.
One of the advantages of Minikube is its ease of use. With a few simple commands, you can set up and start a Kubernetes cluster, deploy applications, and manage resources. It also integrates seamlessly with common Kubernetes tools like kubectl for managing resources and Helm for deploying complex applications.
Another noteworthy feature is Minikubeβs ability to emulate a production-like environment on your local machine. Through the use of add-ons and configurations, you can mimic production setups and constraints, which is particularly useful for testing and validating applications before they are deployed in real-world scenarios.
Installing Minikube
If you are using MacOS, you can install Minikube by running the following commands:
$ brew install minikube
$ brew install kubectl
If you are using another OS, refer to the following official documentation for installation:
Basic Commands to Interact with Minikube
Once Minikube is installed, you can start interacting with it using various commands:
minikube start
Initialize a virtual machine and set up a single-node Kubernetes cluster inside it.
$ minikube start
π minikube v1.30.1 on Darwin 13.0 (arm64)
β¨ Automatically selected the docker driver
π Using Docker Desktop driver with root privileges
π Starting control plane node minikube in cluster minikube
π Pulling base image ...
πΎ Downloading Kubernetes v1.26.3 preload ...
> preloaded-images-k8s-v18-v1...: 330.52 MiB / 330.52 MiB 100.00% 3.50 Mi
> gcr.io/k8s-minikube/kicbase...: 336.39 MiB / 336.39 MiB 100.00% 2.23 Mi
π₯ Creating docker container (CPUs=2, Memory=2200MB) ...
π§― Docker is nearly out of disk space, which may cause deployments to fail! (87% of capacity). You can pass '--force' to skip this check.
π‘ Suggestion:
Try one or more of the following to free up space on the device:
1. Run "docker system prune" to remove unused Docker data (optionally with "-a")
2. Increase the storage allocated to Docker for Desktop by clicking on:
Docker icon > Preferences > Resources > Disk Image Size
3. Run "minikube ssh -- docker system prune" if using the Docker container runtime
πΏ Related issue: https://github.com/kubernetes/minikube/issues/9024
π³ Preparing Kubernetes v1.26.3 on Docker 23.0.2 ...
βͺ Generating certificates and keys ...
βͺ Booting up control plane ...
βͺ Configuring RBAC rules ...
π Configuring bridge CNI (Container Networking Interface) ...
βͺ Using image gcr.io/k8s-minikube/storage-provisioner:v5
π Verifying Kubernetes components...
π Enabled addons: storage-provisioner, default-storageclass
π Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
minikube status
Show the status of the minikube machine and its Kubernetes and kubeconfig statuses.
$ minikube
minikube
type: Control Plane
host: Running
kubelet: Running
apiserver: Running
kubeconfig: Configured
minikube dashboard
This command opens up the Kubernetes dashboard in your default web browser, allowing you to interact with your cluster graphically.
$ minikube dashboard
π Enabling dashboard ...
βͺ Using image docker.io/kubernetesui/dashboard:v2.7.0
βͺ Using image docker.io/kubernetesui/metrics-scraper:v1.0.8
π‘ Some dashboard features require the metrics-server addon. To enable all features please run:
minikube addons enable metrics-server
π€ Verifying dashboard health ...
π Launching proxy ...
π€ Verifying proxy health ...
π Opening http://127.0.0.1:51471/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/ in your default browser...
minikube addons list
List all the available add-ons that you can enable or disable in your cluster.
$ minikube addons list
|-----------------------------|----------|--------------|--------------------------------|
| ADDON NAME | PROFILE | STATUS | MAINTAINER |
|-----------------------------|----------|--------------|--------------------------------|
| ambassador | minikube | disabled | 3rd party (Ambassador) |
| auto-pause | minikube | disabled | Google |
| cloud-spanner | minikube | disabled | Google |
| csi-hostpath-driver | minikube | disabled | Kubernetes |
| dashboard | minikube | enabled β
| Kubernetes |
| default-storageclass | minikube | enabled β
| Kubernetes |
| efk | minikube | disabled | 3rd party (Elastic) |
| freshpod | minikube | disabled | Google |
| gcp-auth | minikube | disabled | Google |
| gvisor | minikube | disabled | Google |
| headlamp | minikube | disabled | 3rd party (kinvolk.io) |
| helm-tiller | minikube | disabled | 3rd party (Helm) |
| inaccel | minikube | disabled | 3rd party (InAccel |
| | | | [info@inaccel.com]) |
| ingress | minikube | disabled | Kubernetes |
| ingress-dns | minikube | disabled | Google |
| istio | minikube | disabled | 3rd party (Istio) |
| istio-provisioner | minikube | disabled | 3rd party (Istio) |
| kong | minikube | disabled | 3rd party (Kong HQ) |
| kubevirt | minikube | disabled | 3rd party (KubeVirt) |
| logviewer | minikube | disabled | 3rd party (unknown) |
| metallb | minikube | disabled | 3rd party (MetalLB) |
| metrics-server | minikube | disabled | Kubernetes |
| nvidia-driver-installer | minikube | disabled | Google |
| nvidia-gpu-device-plugin | minikube | disabled | 3rd party (Nvidia) |
| olm | minikube | disabled | 3rd party (Operator Framework) |
| pod-security-policy | minikube | disabled | 3rd party (unknown) |
| portainer | minikube | disabled | 3rd party (Portainer.io) |
| registry | minikube | disabled | Google |
| registry-aliases | minikube | disabled | 3rd party (unknown) |
| registry-creds | minikube | disabled | 3rd party (UPMC Enterprises) |
| storage-provisioner | minikube | enabled β
| Google |
| storage-provisioner-gluster | minikube | disabled | 3rd party (Gluster) |
| volumesnapshots | minikube | disabled | Kubernetes |
|-----------------------------|----------|--------------|--------------------------------|
kubectl cluster-info
Retrieve information about the cluster.
$ kubectl cluster-info
Kubernetes control plane is running at https://127.0.0.1:49938
CoreDNS is running at https://127.0.0.1:49938/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
kubectl get componentstatus
Check the status of the cluster.
$ kubectl get componentstatus
NAME STATUS MESSAGE ERROR
controller-manager Healthy ok
etcd-0 Healthy {"health":"true","reason":""}
scheduler Healthy ok
kubectl get nodes
Displays a list of cluster nodes.
$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
minikube Ready control-plane 13m v1.26.3
minikube stop
This command stops the running Minikube VM but maintains its state to resume later.
$ minikube stop
β Stopping node "minikube" ...
π Powering off "minikube" via SSH ...
π 1 node stopped.
minikube delete
Completely delete the Minikube VM and all associated state.
$ minikube delete
π₯ Deleting "minikube" in docker ...
π₯ Deleting container "minikube" ...
π₯ Removing /Users/ryuseikakujo/.minikube/machines/minikube ...
π Removed all traces of the "minikube" cluster.
References