How to create, run and manage a Minikube Kubernetes Cluster

·

3 min read

So basically a kubernetes cluster can be used as a set of nodes that run containerized applications. Containerizing applications packages an app with its dependences and some necessary services. They are more lightweight and flexible than virtual machines.

A cluster may consists of several pods and each pod consists of one or more containers which can be managed using different tools. It can managed by AWS, kubernetes itself or using lens.

In our case we will use lens which is a kubernetes IDE which is used to manage a cluster and its pods, containers, deployments, logs, workloads, etc.

Now we should directly jump into Installation so firstly we need Kubectl which is a command line tool used to communicate and control kubernetes cluster

Here is the complete installation link for mac , windows and Linux users:-

kubernetes.io/docs/tasks/tools

  1. We need to download Minikube which is a tool that lets you run Kubernetes locally. Minikube runs an all-in-one or a multi-node local Kubernetes cluster on your personal computer (including Windows, macOS and Linux PCs) so that you can try out Kubernetes, or for daily development work.

Here is the complete link for the installation of Minikube on mac, windows and Linux:-

minikube.sigs.k8s.io/docs/start

Now, Minikube needs a compatible containers or virtual machine manager to make it start hence we need a driver for it we have several options:-

Docker, QEMU, Hyperkit, Hyper-V, KVM, Parallels, VirtualBox, or VMware, Fusion/Workstation, Podman

In this we will use docker so below there is the complete installation of DOCKER:-

run the below commands to install docker

sudo apt update

sudo apt install docker.io -y

Start Docker and Grant Access

Always ensure the docker daemon is up and running.

A easy way to verify your Docker installation is by running the below command

docker run hello-world

If the output says:

docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/create": dial unix /var/run/docker.sock: connect: permission denied.

See 'docker run --help'.

This can mean two things,

Docker deamon is not running.

Your user does not have access to run docker commands.

Start Docker daemon

You use the below command to verify if the docker daemon is actually started and Active

sudo systemctl status docker

If you notice that the docker daemon is not running, you can start the daemon using the below command

sudo systemctl start docker

Grant Access to your user to run docker commands

To grant access to your user to run the docker command, you should add the user to the Docker Linux group. Docker group is create by default when docker is installed.

sudo usermod -aG docker ubuntu

In the above command ubuntu is the name of the user, you can change the username appropriately.

NOTE: : You need to logout and login back for the changes to be reflected.

Docker is Installed, up and running 🥳🥳

Use the same command again, to verify that docker is up and running.

docker run hello-world

Output should look like:

....

....

Hello from Docker!

This message shows that your installation appears to be working correctly.

...

...

Now the creation of Minikube cluster is done let's start using the command

minikube start

This command will start the kubernetes cluster and to check it's status run the command :

minikube status

And to run the kubernetes dashboard on your web browser use the command:

minikube dashboard

To check the running pods on your cluster use

kubectl get pods

And to check the containers running inside the pods of the cluster use command:

docker ps

At last to delete the cluster we will use:

minikube delete

To manage the clusters in a more easy way by using tools which has some nicer interface and easy to understand:

Lens

Monokle

Kubescape

Datree

We will learn about all this tools in the upcoming blogs hence stay tuned