Kubernetes Setups Using minikube

Kubernetes should be run anywhere. It can be integrated with cloud providers AWS & Google Cloud. For home lab or testing purpose minikube is perfect fit. Minikube can quickly spin up on a local machine

  • github link : http://github.com/kubernetets/minikube

Minikube is a tool that makes it easy to run kubernetes locally. Minikube runs a single node kubernetes cluster inside  a Linux VM. Its aims for the users who want to test it out or use it for development.

Minikube seutp:

  • It works on linux,windows or Macos
  • Need a virtualization software installed to run minikube
    • virtualbox is free , can be downloaded from www.virtualbox.com
  • minikube can be downloaded from : http://github.com/kubernetes/minikube
  • Cluster can be launched using  in shell terminal/shell/powershell

In my home lab, I have centos7  installed on my laptop

  • 4 GB ram
  • Core i3 processor (gen2)
  • intel VT enabled in the bios

Note: I have installed virtualbox, curl and wget on my centos 7

[root@localhost ~]# curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.17.1/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

 51 83.3M   51 42.9M    0     0   166k      0  0:08:32  0:04:24  0:04:08  177k

Once the minikube has downloaded, I am starting minikube

[root@localhost /]# minikube start

Starting local Kubernetes cluster...

Starting VM...

Downloading Minikube ISO

 89.24 MB / 89.24 MB [==============================================] 100.00% 0s

SSH-ing files into VM...

Setting up certs...

Starting cluster components...

Connecting to cluster...

Setting up kubeconfig...

Kubectl is now configured to use the cluster.

Note: I have already downloaded kubectl, no need of any configuration,  download and copy in /usr/local/bin.

Checking the config file

[root@localhost /]# ls  ~/.kube/

config

[root@localhost /]# cat ~/.kube/config

apiVersion: v1

clusters:

- cluster:

    certificate-authority: /root/.minikube/ca.crt

    server: https://192.168.99.100:8443

  name: minikube

contexts:

- context:

    cluster: minikube

    user: minikube

  name: minikube

current-context: minikube

kind: Config

preferences: {}

users:

- name: minikube

  user:

    client-certificate: /root/.minikube/apiserver.crt

    client-key: /root/.minikube/apiserver.key

Using kubectl, I am pulling one image from my local docker registry, and exposing the end  point Url.  I am creating a service , exposing port and pulling image from below command.

kubectl run my-jenkins --image=http://localhost:5000/v1/repositories/jenkinslocal/tags/latest --port=8080

deployment " my-jenkins " created
 kubectl expose deployment my-jenkins --type=NodePort

service "my-jenkins" exposed

minikube service my-jenkins –url

Waiting, endpoint for service is not ready yet...

Waiting, endpoint for service is not ready yet...

Waiting, endpoint for service is not ready yet...
#Above command will take time to pull image, depending on internet speed.

Note: It will pull the image, and provide an end point URL