Step 1: Update system
Run the following commands to update all system packages to the latest release:
sudo apt-get update
sudo apt-get install apt-transport-https
sudo apt-get upgrade
Step 2: Install KVM or VirtualBox Hypervisor
For VirtualBox users, install VirtualBox using:
sudo apt install virtualbox virtualbox-ext-pack
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 22.04|20.04|18.04
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.24.0
commit: 76b94fb3c4e8ac5062daf70d60cf03ddcc0a741b
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": "22",
"gitVersion": "v1.22.3",
"gitCommit": "c92036820499fedefec0f847e2054d824aea6cd1",
"gitTreeState": "clean",
"buildDate": "2021-10-27T18:41:28Z",
"goVersion": "go1.16.9",
"compiler": "gc",
"platform": "linux/amd64"
}
}
Step 5: Starting minikube on Ubuntu 22.04|20.04|18.04
Now that components are installed, you can start minikube. VM image will be downloaded and configure d for Kubernetes single node cluster.
$ minikube start --image-mirror-country='cn' --driver=none
Starting local Kubernetes v1.10.0 cluster...
Starting VM...
Downloading Minikube ISO
150.53 MB / 150.53 MB [============================================] 100.00% 0s
Getting VM IP address...
Moving files into cluster...
Downloading kubeadm v1.10.0
Downloading kubelet v1.10.0
Finished Downloading kubeadm v1.10.0
Finished Downloading kubelet v1.10.0
Setting up certs...
Connecting to cluster...
Setting up kubeconfig...
Starting cluster components...
Kubectl is now configured to use the cluster.
Loading cached images from config file.
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 master 13m v1.10.0
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-manager: enabled
- coredns: disabled
- dashboard: enabled
- default-storageclass: enabled
- efk: disabled
- freshpod: disabled
- heapster: disabled
- ingress: disabled
- kube-dns: enabled
- metrics-server: disabled
- registry: disabled
- registry-creds: disabled
- storage-provisioner: 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: