Popular Posts

Minikube Installation Guide

Troubleshoot kubectl version incompatibility

Follow these steps to run Minikube on your mac

  1. Install Docker

  2. Install VirtualBox

  3. Install Kubectl

  4. Install Minikube

Install docker on Mac

docker_installation.sh
brew cask install docker

Install VirtualBox latest version 6.x and above

Check the VirtualBox version

virtualbox_version.sh
$ echo $(virtualbox --help | head -n 1 | awk '{print $NF}')
vb.sh
brew cask uninstall --force virtualbox

brew cask install virtualbox

Install Kubectl

kubectl.sh
brew install kubernetes-cli (1)
1 Refer troubleshooting sections about version issues.

Install Minikube v1.0.1

Make sure you delete older versions , if you have issue with minikube dashboard

delete.sh
minikube delete
minikube_installation.sh
curl -Lo minikube https://storage.googleapis.com/minikube/releases/v1.0.1/minikube-darwin-amd64 && chmod +x minikube && sudo cp minikube /usr/local/bin/ && rm minikube
Don’t use homebrew to install minikube which pulls latest version you may face to start. use stable version.

Starting MiniKube

minikube requires access to the internet via HTTP, HTTPS, and DNS protocols.

If a HTTP proxy is required to access the internet, you may need to pass the proxy connection information to both minikube and Docker using environment variables:

HTTP_PROXY - The URL to your HTTP proxy HTTPS_PROXY - The URL to your HTTPS proxy NO_PROXY - A comma-separated list of hosts which should not go through the proxy. The NO_PROXY variable here is important: Without setting it, minikube may not be able to access resources within the VM. minikube uses two IP ranges, which should not go through the proxy:

192.168.99.0/24: Used by the minikube VM. Configurable for some hypervisors via --host-only-cidr 192.168.39.0/24: Used by the minikube kvm2 driver. 10.96.0.0/12: Used by service cluster IP’s. Configurable via --service-cluster-ip-range

Use below command to start your minikube , if it not behind corporate proxy

start_minikube.sh
export NO_PROXY=localhost,127.0.0.1,10.96.0.0/12,192.168.99.0/24,192.168.39.0/24

tvajjala$minikube start --docker-env NO_PROXY=$NO_PROXY
๐Ÿ˜„  minikube v1.0.1 on darwin (amd64)
๐Ÿคน  Downloading Kubernetes v1.14.1 images in the background ...
๐Ÿ”ฅ  Creating virtualbox VM (CPUs=2, Memory=2048MB, Disk=20000MB) ...
๐Ÿ“ถ  "minikube" IP address is 192.168.99.102
๐ŸŒ  Found network options:
    ▪ NO_PROXY=localhost,127.0.0.1,10.96.0.0/12,192.168.99.0/24,192.168.39.0/24
๐Ÿณ  Configuring Docker as the container runtime ...
    ▪ env NO_PROXY=localhost,127.0.0.1,10.96.0.0/12,192.168.99.0/24,192.168.39.0/24
๐Ÿณ  Version of container runtime is 18.06.3-ce
⌛  Waiting for image downloads to complete ...
✨  Preparing Kubernetes environment ...
๐Ÿšœ  Pulling images required by Kubernetes v1.14.1 ...
๐Ÿš€  Launching Kubernetes v1.14.1 using kubeadm ...
⌛  Waiting for pods: apiserver proxy etcd scheduler controller dns
๐Ÿ”‘  Configuring cluster permissions ...
๐Ÿค”  Verifying component health .....
๐Ÿ’—  kubectl is now configured to use "minikube"
๐Ÿ„  Done! Thank you for using minikube!
if your network behind proxy, use below command
minikube_behind_proxy.sh
export HTTP_PROXY=http://<proxy hostname:port>
export HTTPS_PROXY=https://<proxy hostname:port>
export NO_PROXY=localhost,127.0.0.1,10.96.0.0/12,192.168.99.0/24,192.168.39.0/24

minikube start --docker-env=HTTP_PROXY=$HTTP_PROXY --docker-env HTTPS_PROXY=$HTTPS_PROXY \
  --docker-env NO_PROXY=$NO_PROXY

Status check

status_check.sh
tvajjala$minikube status

host: Running
kubelet: Running
apiserver: Running
kubectl: Correctly Configured: pointing to minikube-vm at 192.168.99.102

Command to view Minikube Dashboard

dashboard.sh
tvajjala$minikube dashboard
๐Ÿ”Œ  Enabling dashboard ...
๐Ÿค”  Verifying dashboard health ...
๐Ÿš€  Launching proxy ...
๐Ÿค”  Verifying proxy health ...
๐ŸŽ‰  Opening http://127.0.0.1:56008/api/v1/namespaces/kube-system/services/http:kubernetes-dashboard:/proxy/ in your default browser...

Command to view all components status

get_info.sh
$ kubectl  get all --namespace=kube-system

Command to view ConfigMap

configmap.sh
$ kubectl get configmap -n kube-system

Command to view deployments

deployments.sh
$ kubectl get deployment --all-namespaces

Command to iew all pods

pods.sh
$ kubectl get pods --all-namespaces

Command to view specific pod logs

logs.sh
kubectl --namespace kube-system logs <POD_NAME>
to view specific pod name run below command
pod_view.sh
kubectl get pods --all-namespaces
  • Describe pod*

describe.sh
kubectl -n kube-system describe po <POD_NAME>
roles.sh
kubectl create role access-secrets --verb=get,list,watch,update,create --resource=secrets

kubectl create rolebinding --role=access-secrets default-to-secrets --serviceaccount=kube-system:default

Cluster information

cluster.sh
kubectl cluster-info

kubectl apply -f deployment.yaml

invalid object doesn’t have additional properties

Troubleshoot kubectl version incompatibility

kubectl_version.sh
tvajjala$kubectl version
Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.7", GitCommit:"0c38c362511b20a098d7cd855f1314dad92c2780", GitTreeState:"clean", BuildDate:"2018-08-20T10:09:03Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.1", GitCommit:"b7394102d6ef778017f2ca4046abbaa23b88c290", GitTreeState:"clean", BuildDate:"2019-04-08T17:02:58Z", GoVersion:"go1.12.1", Compiler:"gc", Platform:"linux/amd64"}

stable kubectl

filename.sh
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/darwin/amd64/kubectl

If your kubectl still showing older version , make sure you have other versions installed

my case i have Google SDK which causing issue, follow below steps to delete or upgrade GCK

Locate your installation directory by running:

 gcloud info --format='value(installation.sdk_root)'
Locate your user config directory (typically ~/.config/gcloud on MacOS and Linux) by running:
 gcloud info --format='value(config.paths.global_config_dir)'
Delete both these directories.

Additionally, remove lines sourcing completion.bash.inc and paths.bash.inc in your .bashrc or equivalent shell init file, if you added them during installation

and finally it solved the problem

filename.sh
tvajjala$kubectl version
Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.1", GitCommit:"b7394102d6ef778017f2ca4046abbaa23b88c290", GitTreeState:"clean", BuildDate:"2019-04-08T17:11:31Z", GoVersion:"go1.12.1", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.1", GitCommit:"b7394102d6ef778017f2ca4046abbaa23b88c290", GitTreeState:"clean", BuildDate:"2019-04-08T17:02:58Z", GoVersion:"go1.12.1", Compiler:"gc", Platform:"linux/amd64"}

No comments:

Post a Comment