Minikube is a tool that makes it easy to run Kubernetes locally. It runs a single-node Kubernetes cluster inside a VM on your laptop for users looking to try out Kubernetes or develop with it day-to-day.

Minikube supports different drivers to run aforementioned VM like KVM, hyper kit, virtual box etc. You can also run minikube on the host using vm-driver as none. This option is supported only on linux machines.

Installation

1. Download minikube binaries from unicamp repo: http://ftp.unicamp.br/pub/ppc64el/ubuntu/16_04/minikube/

2. There are two binaries i.e. minikube and localkube. Download both the binaries to your local system and make them executable.

# chmod +x minikube
# chmod +x localkube

3. Create a directory ~/.minikube/cache/localkube on your system and copy the localkube binary to that directory. Change the localkube binary name to localkube-v1.8.0. In the end you should be able to get this output:

# ls ~/.minikube/cache/localkube
localkube-v1.8.0

4. Copy minikube to /usr/bin/ or anywhere else in your path and run the following command:

# minikube start —vm-driver=none

You should see the following output:

# ./minikube –vm-driver=none start
Starting local Kubernetes v1.8.0 cluster…
Starting VM…
Getting VM IP address…
Moving files into cluster…
Setting up certs…
Connecting to cluster…
Setting up kubeconfig…
Starting cluster components…
Kubectl is now configured to use the cluster.
===================
WARNING: IT IS RECOMMENDED NOT TO RUN THE NONE DRIVER ON PERSONAL WORKSTATIONS
The ‘none’ driver will run an insecure kubernetes apiserver as root that may leave the host vulnerable to CSRF attacks

When using the none driver, the kubectl config and credentials generated will be root owned and will appear in the root home directory.
You will need to move the files to the appropriate location and then set the correct permissions. An example of this is below:

sudo mv /root/.kube $HOME/.kube # this will write over any previous configuration
sudo chown -R $USER $HOME/.kube
sudo chgrp -R $USER $HOME/.kube

sudo mv /root/.minikube $HOME/.minikube # this will write over any previous configuration
sudo chown -R $USER $HOME/.minikube
sudo chgrp -R $USER $HOME/.minikube

This can also be done automatically by setting the env var CHANGE_MINIKUBE_NONE_USER=true

5. Check the status of minikube by running:

# minikube status
minikube: Running
cluster: Running
kubectl: Correctly Configured: pointing to minikube-vm at 127.0.0.1

6. Use kubectl command to use your local cluster.

# kubectl get nodes
NAME     STATUS     ROLES     AGE     VERSION
ubuntu     Ready                       49m      v1.8.0

Troubleshooting

1. If kubectl can’t connect to the cluster, check the minikube status:

# minikube status
minikube: Stopped
cluster:
kubectl:

Check if you are using the right localkube binary. Remove the existing localkube binary and replace the cached binary with the unicamp one (Step 3 in installation).

2. Check the logs of minikube using:

# minikube logs

Join The Discussion

Your email address will not be published. Required fields are marked *