In this tutorial, I’ll take you through the steps to install minikube on Ubuntu 22.04|20.04|18.04 Linux system. To those new to minikube, let’s start with an introduction before diving to the installation steps.
Minikube is an open source tool that was developed to enable developers and system administrators to run a single cluster of Kubernetes on their local machine. Minikube starts a single node kubernetes cluster locally with small resource utilization. This is ideal for development tests and POC purposes.
For CentOS, check out: Installing Minikube on CentOS 7/8 with KVM
In a nutshell, Minikube packages and configures a Linux VM, then installs Docker and all Kubernetes components into it.
Minikube supports Kubernetes features such as:
- DNS
- NodePorts
- ConfigMaps and Secrets
- Dashboards
- Container Runtime: Docker, CRI-O, and containerd
- Enabling CNI (Container Network Interface)
- Ingress
- PersistentVolumes of type hostPath
Hypervisor choice for Minikube: Minikube supports both VirtualBox and KVM hypervisors. This guide will cover both hypervisors.
Step 1: Update system
Run the following commands to update all system packages to the latest release:
sudo apt update
sudo apt upgrade
If a reboot is required after the upgrade then perform the process.
[ -f /var/run/reboot-required ] && sudo reboot -f
Step 2: Install KVM or VirtualBox Hypervisor
For VirtualBox users, install VirtualBox using:
KVM Hypervisor Users
For those interested in using KVM hypervisor, check our guide on how to Install KVM on CentOS / Ubuntu / Debian
Then follow How to run Minikube on KVM instead.
Step 3: Download minikube on Ubuntu
You need to download the minikube binary. I will put the binary under /usr/local/bin directory since it is inside $PATH.
wget https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
chmod +x minikube-linux-amd64
sudo mv minikube-linux-amd64 /usr/local/bin/minikube
Confirm version installed
$ minikube version
minikube version: v1.30.1
commit: 08896fd1dc362c097c925146c4a0d0dac715ace0
Step 4: Install kubectl on Ubuntu
We need kubectl which is a command line tool used to deploy and manage applications on Kubernetes:
curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl
Make the kubectl binary executable.
chmod +x ./kubectl
Move the binary in to your PATH:
sudo mv ./kubectl /usr/local/bin/kubectl
Check version:
$ kubectl version -o json --client
{
"clientVersion": {
"major": "1",
"minor": "26",
"gitVersion": "v1.26.1",
"gitCommit": "8f94681cd294aa8cfd3407b8191f6c70214973a4",
"gitTreeState": "clean",
"buildDate": "2023-01-18T15:58:16Z",
"goVersion": "go1.19.5",
"compiler": "gc",
"platform": "linux/amd64"
},
"kustomizeVersion": "v4.5.7"
}
Step 5: Starting minikube on Ubuntu
Now that components are installed, you can start minikube. VM image
will be downloaded and configure d for Kubernetes single node cluster.
$ minikube start
...................................
😄 minikube v1.28.0 on linux (amd64)
💿 Downloading Minikube ISO ...
129.33 MB / 129.33 MB [============================================] 100.00% 0s
🔥 Creating kvm2 VM (CPUs=2, Memory=2048MB, Disk=20000MB) ...
😄 minikube v1.28.0 on linux (amd64)
🐳 Configuring environment for Kubernetes v1.25.3
💾 Downloading kubeadm v1.25.3
💾 Downloading kubelet v1.25.3
🚜 Pulling images ...
🚀 Launching Kubernetes ...
⌛ Verifying: apiserver proxy etcd scheduler controller dns
🏄 Done! kubectl is now configured to use "minikube"
Wait for the download and setup to finish then confirm that everything is working fine.
Step 6: Minikube Basic operations
To check cluster status, run:
$ kubectl cluster-info
Kubernetes master is running at https://192.168.39.117:8443
KubeDNS is running at https://192.168.39.117:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
Note that Minikube configuration file is located under ~/.minikube/machines/minikube/config.json
To View Config, use:
$ kubectl config view
apiVersion: v1
clusters:
- cluster:
certificate-authority: /home/jmutai/.minikube/ca.crt
server: https://192.168.39.117:8443
name: minikube
contexts:
- context:
cluster: minikube
user: minikube
name: minikube
current-context: minikube
kind: Config
preferences: {}
users:
- name: minikube
user:
client-certificate: /home/jmutai/.minikube/client.crt
client-key: /home/jmutai/.minikube/client.key
To check running nodes:
$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
minikube Ready control-plane 162m v1.25.3
Access minikube VM using ssh:
$ minikube ssh
_ _
_ _ ( ) ( )
___ ___ (_) ___ (_)| |/') _ _ | |_ __
/' _ ` _ `\| |/' _ `\| || , < ( ) ( )| '_`\ /'__`\
| ( ) ( ) || || ( ) || || |\`\ | (_) || |_) )( ___/
(_) (_) (_)(_)(_) (_)(_)(_) (_)`\___/'(_,__/'`\____)
$ sudo su -
To stop a running local kubernetes cluster, run:
$ minikube stop
To delete a local kubernetes cluster, use:
$ minikube delete
Step 7: Enable Kubernetes Dashboard
Kubernete ships with a web dashboard which
allows you to manage your cluster without interacting with a command
line. The dashboard addon is installed and enabled by default on
minikube.
$ 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 |
| | | | [[email protected]]) |
| 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 |
|-----------------------------|----------|--------------|--------------------------------|
To enable a module use command:
minikube addons enable <module>
Example:
$ minikube addons enable portainer
! portainer is a 3rd party addon and is not maintained or verified by minikube maintainers, enable at your own risk.
! portainer does not currently have an associated maintainer.
- Using image docker.io/portainer/portainer-ce:2.15.1
* The 'portainer' addon is enabled
To open directly on your default browser, use:
$ minikube dashboard
To get the URL of the dashboard
$ minikube dashboard --url
http://192.168.39.117:30000
Access Kubernetes Dashboard by opening the URL on your favorite browser. For further reading, check:
- Hello Minikube Series: https://kubernetes.io/docs/tutorials/stateless-application/hello-minikube/
- Minikube guides for newbies available at: https://kubernetes.io/docs/getting-started-guides/minikube/
More guides on Kubernetes:
- How To Schedule Pods on Kubernetes Control plane (Master) Nodes
- How To Join new Kubernetes Worker Node to an existing Cluster
- Deploy Kubernetes Cluster on CentOS 7 / CentOS 8 With Ansible and Calico CNI
- How To Deploy Metrics Server to Kubernetes Cluster
- How To Manually Pull Container images used by Kubernetes kubeadm
- Install and Use Helm 3 on Kubernetes Cluster