Goglides Dev 🌱

Niraj Pradhan
Niraj Pradhan

Posted on • Updated on • Originally published at goglides.dev

Creating first kubernetes (k8s) cluster with minikube. Lets go..

Kubernetes (k8s)

Kubernetes is an open source Container Orchestrator for managing, maintaining, monitoring, automating multiple containers in an efficient way.

About this post

In this post, i will try to include how to create k8s cluster with minikube and how to interact with clusters with kubectl.

Basic terminology

Cluster - a set of computers as nodes working together and perform some task.

Minikube - a command-line tool to create to learn , develop kubernetes, k8s clusters in local environment.

Kubectl - a command-line tool, to interact with the clusters. It is used to deploy, manage, view logs of clusters.

Requirement

Whether we can use docker container or virtual machine environment. But one is mandatory for creating k8s clusters.

Installation

(🐧 Linux)


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

Enter fullscreen mode Exit fullscreen mode

(Mac OS)


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

Enter fullscreen mode Exit fullscreen mode

If you are using windows, Please follow official installation guide provided by Minikube. Check it out

After this, installation in particular operating system.
Let's start our first cluster.

~ minikube start

Enter fullscreen mode Exit fullscreen mode

Issues while starting minikube due to permission denied

We'll get this issue, because we don't have permission to write /var/run/docker.sock file.

Let's check the access to the /var/run/docker.sock file

~ ls -l /var/run/docker.sock

Enter fullscreen mode Exit fullscreen mode

You'll find that root user and user group of docker only have the permission to write.

Let's change user mode in the user group of docker.

~ sudo usermod -aG docker <username> && newgrp docker

Enter fullscreen mode Exit fullscreen mode

After all this, we can start the cluster with minikube.

~ minikube start

Enter fullscreen mode Exit fullscreen mode

Cluster started

🎉 Finally our first cluster is started successfully.

We can check the status of cluster.

~ minikube status
Enter fullscreen mode Exit fullscreen mode

Cluster status

Let's interact with our cluster with kubectl.

~ kubectl get po -A

Enter fullscreen mode Exit fullscreen mode

It will displays all the Pods as in picture below. Pods are the smallest deployable units of computing that you can create and manage in Kubernetes.

Pods list

~ kubectl get nodes

Enter fullscreen mode Exit fullscreen mode

It will display nodes. Nodes are the physical or virtual machine depends on the cluster we use and the purpose of cluster.

Nodes

Now,We can check the cluster status in minikube dashboard,

~ minikube dashboard

Enter fullscreen mode Exit fullscreen mode

Minikube dashboard

Minikube is a popular tool for learning, developing clusters in development and local environment but it cannot be used in production deployment.

Local vs Production

Hope, you get the basic concepts and workflows of kubernetes cluster.

Top comments (0)