Minikube is a tool written in Golang to set up the kubernetes cluster locally on the machine.It will require virtualization to be enabled for Operating System. It supports Container Network Interface (CNI Plugins), Domain Name System, Kubernetes Dashboard, Ingress for load balancing, Config Maps and Secrets and Container runtime which can be docker or rkt.

There are many solutions available for setting up Kubernetes cluster for different environment. To get start with the Kubernetes, Minikube is one of the most preferred option.Virtual Machine will be required to run minikube locally on machine.In previous blog, we explained how to setup the Kubernetes Cluster on Azure Container Service. You can visit the blog here. For more information about minikube visit this link.

Install a Hypervisor:

Check if CPU supports hardware virtualization: ( If value > 0 then it supports)

$ egrep -c ‘(vmx|svm)’ /proc/cpuinfo

Download VirtualBox:

$ curl -LO http://download.virtualbox.org/virtualbox/5.2.0/virtualbox-5.2_5.2.0-118431~Ubuntu~xenial_amd64.deb

Install using Debian package manager:

$ sudo dpkg -i virtualbox-5.2_5.2.0-118431-Ubuntu-xenial_amd64.deb

Install Kubectl:

Kubectl is the command line utility which interacts with API Server of the Kubernetes.

Download Kubectl Stable Binary:

$ 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 binary executable:

$ chmod +x ./kubectl

Move binary to the system path:

$ sudo mv ./kubectl /usr/local/bin/kubectl

Check if Kubectl is configured or not:

$kubectl
kubectl controls the Kubernetes cluster manager.

Find more information at https://github.com/kubernetes/kubernetes.

Basic Commands (Beginner):
 create         Create a resource by filename or stdin
 expose         Take a replication controller, service, deployment or pod and expose it as a new Kubernetes Service
 run            Run a particular image on the cluster
 run-container  Run a particular image on the cluster
 set            Set specific features on objects


Install Minikube:

$curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.22.3/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/

Verify Installation:

$minikube
Minikube is a CLI tool that provisions and manages single-node Kubernetes clusters optimized for development workflows.

Usage:
 minikube [command]

Available Commands:
 addons           Modify minikube’s kubernetes addons
 completion       Outputs minikube shell completion for the given shell (bash)
 config           Modify minikube config
 dashboard        Opens/displays the kubernetes dashboard URL for your local cluster
 delete           Deletes a local kubernetes cluster
 docker-env       Sets up docker env variables; similar to ‘$(docker-machine env)’
 get-k8s-versions Gets the list of available kubernetes versions available for minikube
 ip               Retrieves the IP address of the running cluster

This will verify the Minikube is installed successfully. Minikube will use default container engine (docker here) to run the app.


Create Kubernetes Cluster through Minikube:

$ minikube start

Verify the Kubernetes Cluster Started:

$ minikube start
Starting local Kubernetes v1.7.5 cluster…
Starting VM…
Getting VM IP address…
Moving files into cluster…
Setting up certs…
Connecting to cluster…
Setting up kubeconfig…
Starting cluster components…
Kubectl is now configured to use the cluster.

The K8S cluster is successfully deployed on local machine.
To verify run following command:

$ kubectl config get-clusters

It will list the clusters. You should get the result like:

$ kubectl config get-clusters
NAME
minikube

Here Kubectl is successfully configured and Kubernetes cluster will be running on local machine.Minikube is the useful tool in the development environment. 

Leave a Reply

Your email address will not be published. Required fields are marked *