Friday, January 04, 2019

How To Install MiniKube Inside Linux

Requirement

  • Make sure your linux  CPU has vmx svm supported. run below to check. If none return, it means your linux does not support refer doc 
 egrep '(vmx|svm)' /proc/cpuinfo
  • Otherwise you may get error like
E0830 20:33:53.017334   30356 start.go:174] Error starting host: Error creating host: Error creating machine: Error in driver during machine creation: creating domain: Error defining domain xml:

Install kubectl first

  • setup your proxy on the OS if it is behind firewall
add this into .bash_profile
export http_proxy=http://www-proxy.us.test.com:80/
export https_proxy=http://www-proxy.us.test.com:80/
  • download kubectl from google which is only 1 big file
  • 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
  • mv ./kubectl  /usr/bin/kubectl
  • test it to run : kubectl version to see any output. example like 
# kubectl version
    Client Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.2", GitCommit:"bb9ffb1654d4a729bb4cec18ff088eacc153c239", GitTreeState:"clean", BuildDate:"2018-08-07T23:17:28Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"}
      The connection to the server localhost:8080 was refused - did you specify the right host or port?
      • connection refused error can be ignored
      • refer doc 

      Install KVM2 Driver&Start Libvirtd Service for virutal machine

      • refer doc
      • #yum install libvirt
      • #yum install libvirt-daemon-kvm qemu-kvm
      • # newgrp libvirt
      • # usermod -a -G libvirt $(whoami)
      •  systemctl start  libvirtd.service
      • download driver from google
      # curl -Lo docker-machine-driver-kvm2 https://storage.googleapis.com/minikube/releases/latest/docker-machine-driver-kvm2 \
      && chmod +x docker-machine-driver-kvm2 \
      && sudo cp docker-machine-driver-kvm2 /usr/bin/ \
      && rm docker-machine-driver-kvm2

      Install / Start minikube 

      • refer doc
      • download minikube which is only 1 file
      • curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.28.2/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/bin/
       #minikube version
      minikube version: v0.28.2

      • # minikube start   --vm-driver kvm2
      Starting local Kubernetes v1.10.0 cluster...
      Starting VM...
      Downloading Minikube ISO
       160.27 MB / 160.27 MB [============================================] 100.00% 0s
      Getting VM IP address...
      Moving files into cluster...
      Downloading kubeadm v1.10.0
      Downloading kubelet v1.10.0
      Finished Downloading kubelet v1.10.0
      Finished Downloading kubeadm v1.10.0
      Setting up certs...
      Connecting to cluster...
      Setting up kubeconfig...
      Starting cluster components...

      No comments: