Configure Kubernetes with minikube

We have discussed about Docker Swarm to know how to use Docker as a Load balance. Today we will discuss about Kubernetes –

Wiki:

“Kubernetes is an open-source container orchestration system for automating application deployment, scaling, and management. It was originally designed by Google and is now maintained by the Cloud Native Computing Foundation”

I will be using Romin irani’s blog to configure Minikube and kubernetes:

I am using Window’s 10 pro.

using same MySwitch network – Hyper-V Manager

install and configure minikube as

>C:\Windows\system32>minikube start –vm-driver hyperv –hyperv-virtual-switch “MySwitch”

Starting local Kubernetes v1.13.2 cluster…
Starting VM…
Downloading Minikube ISO
181.48 MB / 181.48 MB [============================================] 100.00% 0s
Getting VM IP address…
Moving files into cluster…
Downloading kubelet v1.13.2
Downloading kubeadm v1.13.2
Finished Downloading kubeadm v1.13.2
Finished Downloading kubelet v1.13.2
Setting up certs…
Connecting to cluster…
Setting up kubeconfig…
Stopping extra container runtimes…
Starting cluster components…
Verifying kubelet health …
Verifying apiserver health …
Kubectl is now configured to use the cluster.
Loading cached images from config file.
Everything looks great. Please enjoy minikube!

>C:\Windows\system32>minikube version

minikube version: v0.33.1

>C:\Windows\system32>kubectl cluster-info

Kubernetes master is running at https://10.0.0.116:8443
KubeDNS is running at https://10.0.0.116:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
To further debug and diagnose cluster problems, use ‘kubectl cluster-info dump’.

minikube ip address:

>C:\Windows\system32>minikube ip

10.0.0.116

C:\Windows\system32>minikube status
host: Running
kubelet: Running
apiserver: Running
kubectl: Correctly Configured: pointing to minikube-vm at 10.0.0.116

 

 

C:\Windows\system32>kubectl version
Client Version: version.Info{Major:”1″, Minor:”10″, GitVersion:”v1.10.3″, GitCommit:”2bba0127d85d5a46ab4b778548be28623b32d0b0″, GitTreeState:”clean”, BuildDate:”2018-05-21T09:17:39Z”, GoVersion:”go1.9.3″, Compiler:”gc”, Platform:”windows/amd64″}
Server Version: version.Info{Major:”1″, Minor:”13″, GitVersion:”v1.13.2″, GitCommit:”cff46ab41ff0bb44d8584413b598ad8360ec1def”, GitTreeState:”clean”, BuildDate:”2019-01-10T23:28:14Z”, GoVersion:”go1.11.4″, Compiler:”gc”, Platform:”linux/amd64″}

 

C:\Windows\system32>minikube dashboard
Enabling dashboard …
Verifying dashboard health …
Launching proxy …
Verifying proxy health …
Opening http://127.0.0.1:50096/api/v1/namespaces/kube-system/services/http:kubernetes-dashboard:/proxy/ in your default browser…

This will open a kubernetes dashboard on browser

http://127.0.0.1:50096/api/v1/namespaces/kube-system/services/http:kubernetes-dashboard:/proxy/#!/deployment?namespace=default

Following options are to be consider:

Node: Number of nodes

Deployment: deployment status

Pod: Number of pods

Service: service deployed

replica sets: number of replica sets

similar information can be retrieved from command prompt

C:\Windows\system32>kubectl get nodes
NAME STATUS ROLES AGE VERSION
minikube Ready master 5m v1.13.2

 

C:\Windows\system32>kubectl.exe run hello-nginx –image=nginx –port=80
deployment.apps “hello-nginx” created

 

C:\Windows\system32>kubectl get pods
NAME READY STATUS RESTARTS AGE
hello-nginx-79cd57d7cd-4whlz 1/1 Running 0 32s

 

C:\Windows\system32>kubectl.exe expose deployment hello-nginx –type=NodePort
service “hello-nginx” exposed

 

C:\Windows\system32>kubectl get services
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
hello-nginx NodePort 10.111.96.190 <none> 80:31251/TCP 53s
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 13m

 

C:\Windows\system32>kubectl scale –replicas=3 deployment/hello-nginx
deployment.extensions “hello-nginx” scaled

 

C:\Windows\system32>kubectl get deployment
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
hello-nginx 3 3 3 3 10m

 

C:\Windows\system32>kubectl get nodes
NAME STATUS ROLES AGE VERSION
minikube Ready master 19m v1.13.2

 

C:\Windows\system32>kubectl get pods
NAME READY STATUS RESTARTS AGE
hello-nginx-79cd57d7cd-4whlz 1/1 Running 0 11m
hello-nginx-79cd57d7cd-czf9l 1/1 Running 0 1m
hello-nginx-79cd57d7cd-smxdk 1/1 Running 0 1m

 

in this blog we have successfully configured kubernetes – minikube cluster using hyper-v on windows 10. with 3 replica set pods of nginx service as a load balance.

 

 

 

 

 

 

 

This entry was posted in Cloud, DevOps, High Avaliability, Kubernetes/Docker/Container, Others and tagged , , , . Bookmark the permalink.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.