Setup

Minikube is kubernetes all in one setup, easy to install, used for developments, learning.

Throughout this book, I am using minikube in a VM.

VM Specification: Ubuntu 14.04, Cores 4, Memory 16 GB. HD- 50GB

Kubectl Installation

curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv kubectl /usr/local/bin/.
source <(kubectl completion bash)
echo "source <(kubectl completion bash)" >> ~/.bashrc
kubectl cluster-info

Minikube Installation

Setting up the environment requires Minikube

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

Libvirt & KVM Installation

sudo apt install -y libvirt-bin qemu-kvm
sudo usermod -a -G libvirtd $(whoami)
newgrp libvirtd

Install the kvm driver for minkube

sudo curl -L https://github.com/docker/machine/releases/download/v0.12.2/docker-machine-`uname -s`-`uname -m` >/tmp/docker-machine && sudo chmod +x /tmp/docker-machine && sudo cp /tmp/docker-machine /usr/local/bin/docker-machine

curl -L https://github.com/dhiltgen/docker-machine-kvm/releases/download/v0.10.0/docker-machine-driver-kvm-ubuntu14.04 > docker-machine-driver-kvm
chmod +x docker-machine-driver-kvm 
sudo mv docker-machine-driver-kvm /usr/local/bin/docker-machine-driver-kvm

Testing the MINIKUBE with KVM DRIVER

minikube start --vm-driver=kvm
minikube version
kubectl version
kubectl cluster-info
kubectl get nodes

Thats all.


Some more details :

Start the minikube, and check it

cloud@mkube:~$ sudo minikube start
Starting local Kubernetes v1.7.0 cluster...
Starting VM...
Getting VM IP address...
Moving files into cluster...
Setting up certs...
Starting cluster components...
Connecting to cluster...
Setting up kubeconfig...
Kubectl is now configured to use the cluster.
cloud@mkube:~$ 

cloud@mkube:~$ sudo kubectl version
Client Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.0", GitCommit:"6e937839ac04a38cac63e6a7a306c5d035fe7b0a", GitTreeState:"clean", BuildDate:"2017-09-28T22:57:57Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.0", GitCommit:"d3ada0119e776222f11ec7945e6d860061339aad", GitTreeState:"clean", BuildDate:"2017-07-26T00:12:31Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}
cloud@mkube:~$ 

cloud@mkube:~$ sudo kubectl cluster-info
Kubernetes master is running at https://192.168.42.172:8443

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
cloud@mkube:~$ sudo kubectl get nodes
NAME       STATUS    ROLES     AGE       VERSION
minikube   Ready     <none>    4d        v1.7.0
cloud@mkube:~$

My VM IP(eth0) is 10.0.1.4.

After installed the kubeclt, virbr1 interface is created (IP: 192.168.42.1).

Minikube launch a VM (minikube) and runs in ip 192.168.42.172. This VM is all in one(kubernets master and nodes).

Checking the details of the node

kubectl get nodes

kubectl describe node <node name>

cloud@mkube:~$ kubectl describe node minikube 
Name:               minikube
Roles:              <none>
Labels:             beta.kubernetes.io/arch=amd64
                    beta.kubernetes.io/os=linux
                    kubernetes.io/hostname=minikube
Annotations:        alpha.kubernetes.io/provided-node-ip=192.168.42.172
                    node.alpha.kubernetes.io/ttl=0
                    volumes.kubernetes.io/controller-managed-attach-detach=true
Taints:             <none>
CreationTimestamp:  Sun, 08 Oct 2017 14:32:52 +0000
Conditions:
  Type             Status  LastHeartbeatTime                 LastTransitionTime                Reason                       Message
  ----             ------  -----------------                 ------------------                ------                       -------
  OutOfDisk        False   Fri, 13 Oct 2017 05:39:53 +0000   Sun, 08 Oct 2017 14:32:52 +0000   KubeletHasSufficientDisk     kubelet has sufficient disk space available
  MemoryPressure   False   Fri, 13 Oct 2017 05:39:53 +0000   Sun, 08 Oct 2017 14:32:52 +0000   KubeletHasSufficientMemory   kubelet has sufficient memory available
  DiskPressure     False   Fri, 13 Oct 2017 05:39:53 +0000   Sun, 08 Oct 2017 14:32:52 +0000   KubeletHasNoDiskPressure     kubelet has no disk pressure
  Ready            True    Fri, 13 Oct 2017 05:39:53 +0000   Fri, 13 Oct 2017 05:31:07 +0000   KubeletReady                 kubelet is posting ready status
Addresses:
  InternalIP:  192.168.42.172
  Hostname:    minikube
Capacity:
 cpu:     2
 memory:  2048500Ki
 pods:    110
Allocatable:
 cpu:     2
 memory:  1946100Ki
 pods:    110
System Info:
 Machine ID:                 28630d394c7d4b729dce92b3e5eb8af6
 System UUID:                166F7826-EF4F-4994-899C-43BE06FEA0C1
 Boot ID:                    388717b3-2c19-451f-a51c-c4860bbc4a3c
 Kernel Version:             4.9.13
 OS Image:                   Buildroot 2017.02
 Operating System:           linux
 Architecture:               amd64
 Container Runtime Version:  docker://1.12.6
 Kubelet Version:            v1.7.0
 Kube-Proxy Version:         v1.7.0
ExternalID:                  minikube
Non-terminated Pods:         (4 in total)
  Namespace                  Name                              CPU Requests  CPU Limits  Memory Requests  Memory Limits
  ---------                  ----                              ------------  ----------  ---------------  -------------
  default                    hello-minikube-180744149-5skl8    0 (0%)        0 (0%)      0 (0%)           0 (0%)
  kube-system                kube-addon-manager-minikube       5m (0%)       0 (0%)      50Mi (2%)        0 (0%)
  kube-system                kube-dns-910330662-5bz2t          260m (13%)    0 (0%)      110Mi (5%)       170Mi (8%)
  kube-system                kubernetes-dashboard-xs7p8        0 (0%)        0 (0%)      0 (0%)           0 (0%)
Allocated resources:
  (Total limits may be over 100 percent, i.e., overcommitted.)
  CPU Requests  CPU Limits  Memory Requests  Memory Limits
  ------------  ----------  ---------------  -------------
  265m (13%)    0 (0%)      160Mi (8%)       170Mi (8%)
Events:
  Type     Reason                   Age   From                  Message
  ----     ------                   ----  ----                  -------
  Normal   Starting                 9m    kube-proxy, minikube  Starting kube-proxy.
  Normal   Starting                 9m    kubelet, minikube     Starting kubelet.
  Normal   NodeAllocatableEnforced  9m    kubelet, minikube     Updated Node Allocatable limit across pods
  Normal   NodeHasSufficientDisk    8m    kubelet, minikube     Node minikube status is now: NodeHasSufficientDisk
  Normal   NodeHasSufficientMemory  8m    kubelet, minikube     Node minikube status is now: NodeHasSufficientMemory
  Normal   NodeHasNoDiskPressure    8m    kubelet, minikube     Node minikube status is now: NodeHasNoDiskPressure
  Warning  Rebooted                 8m    kubelet, minikube     Node minikube has been rebooted, boot id: 388717b3-2c19-451f-a51c-c4860bbc4a3c
  Normal   NodeNotReady             8m    kubelet, minikube     Node minikube status is now: NodeNotReady
  Normal   NodeReady                8m    kubelet, minikube     Node minikube status is now: NodeReady
cloud@mkube:~$ 
cloud@mkube:~$

References:

https://kubernetes.io/docs/getting-started-guides/minikube/

https://kubernetes.io/docs/tasks/tools/install-minikube/

https://kubernetes.io/docs/tutorials/kubernetes-basics/

results matching ""

    No results matching ""