To familiarize yourself with the topic, let's start with the implementation of a cluster consisting of a single node. For more information, see the official minikube website.

Practice in a simulated environment

Before starting with the installation of our mini-cluster, it is possible to do some practice in a simulated environment. By connecting to the site Minikube Tutorial, you can learn the commands and fundamental components useful for managing a cluster. In this tutorial, in addition to studying theory, you will also have to touch how to manage a sample app on Kubernetes using Minikube and Katacoda (Katacoda provides a free, in-browser Kubernetes environment): you will learn how to deploy a sample application on Minikube, run the app, view application logs, and so on.MiniKube Tutorial

Installation

Assumption

Container or virtual machine manager (e.g. Docker, Hyperkit, Hyper-V, KVM, Parallels, Podman, VirtualBox, or VMware Fusion/Workstation) must be installed on your VM.

Let's try to install MiniKube and Kubectl on our VM

Download
$ curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
$ sudo install minikube-linux-amd64 /usr/local/bin/minikube

$ curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
$ chmod +x kubectl
$ sudo mv kubectl /usr/local/bin/

Launch the MiniKube cluster

Launch
$ minikube start
minikube v1.25.1 on Centos 7.9.2009 (amd64)
Automatically selected the docker driver. Other choices: none, ssh
Starting control plane node minikube in cluster minikube
Pulling base image ...
Downloading Kubernetes v1.23.1 preload ...
 > preloaded-images-k8s-v16-v1...: 504.42 MiB / 504.42 MiB  100.00% 172.50 M
 > gcr.io/k8s-minikube/kicbase: 378.97 MiB / 378.98 MiB  100.00% 23.89 MiB p
Creating docker container (CPUs=2, Memory=2200MB) ...
Preparing Kubernetes v1.23.1 on Docker 20.10.12 ...
 ▪ kubelet.housekeeping-interval=5m
 ▪ Generating certificates and keys ...
 ▪ Booting up control plane ...
 ▪ Configuring RBAC rules ...
Verifying Kubernetes components...
 ▪ Using image gcr.io/k8s-minikube/storage-provisioner:v5
Enabled addons: default-storageclass, storage-provisioner
kubectl not found. If you need it, try: 'minikube kubectl -- get pods -A'
Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default

To verify that no errors were found in the procedure carried out, we launch a couple of control commands. The output should look like this

Minikube version and status
$ minikube version
minikube version: v1.25.1
commit: 3e64b11ed75e56e4898ea85f96b2e4af0301f43d

$ minikube status
minikube
type: Control Plane
host: Running
kubelet: Running
apiserver: Running
kubeconfig: Configured

MiniKube Dashboard

Now, we launch the MiniKube dashboard via

Dashboard
# The dashboard could be already enabled for your minikube deployment, you can check with the following command
$ minikube addons list

# In case it's not enabled, to enable the dashboard for your minikube deployment, use
$ minikube addons enable metrics-server 
$ minikube addons enable dashboard

There are some workarounds to have kubectl proxy work in this environment:

  • use kubectl port-forward to expose the dashboard;
  • configure kubectl on your local machine (your laptop) so that it can talk to the minikube cluster running on the remote VM;
  • expose the dashboard using the ingress controller (or a nodeport service).

The solution that is simpler to implement is the first one.

Dashboard example
kubectl --namespace=kubernetes-dashboard port-forward --address 0.0.0.0 svc/kubernetes-dashboard 8080:80
Forwarding from 0.0.0.0:8080 -> 9090

By entering within a browser the address http://<FIP_VM>:8080, we connect to our dashboard

MiniKube Dashboard

Uninstall MiniKube

To uninstall MiniKube run the following commands

Uninstall MiniKube
$ minikube stop
Stopping node "minikube"  ...
Powering off "minikube" via SSH ...
1 nodes stopped.

$ minikube delete
Deleting "minikube" in docker ...
Deleting container "minikube" ...
Removing /home/centos/.minikube/machines/minikube ...
Removed all traces of the "minikube" cluster.

$ rm -r ~/.kube ~/.minikube
$ sudo rm /usr/local/bin/kubectl /usr/local/bin/minikube

2 Comments

  1. Anonymous

    At the "Configuration changes" step, hostname -i should probably be included in backticks <`> instead of single quotes <'>. Better yet would be to write $(hostname -i), so as to be more readily legible.