kubernetes Getting started with kubernetes Installing Minikube


Example

Minikube creates a local cluster of virtual machines to run Kubernetes on.It is the simplest method to get your hands dirty with Kubernetes on your local machine.

Documentation for Minikube can be found at http://kubernetes.io/docs/getting-started-guides/minikube/

Requirements

To check if virtualization support is enabled, run the appropriate command from below. The command will output something if virtualization is enabled.

# On Linux
cat /proc/cpuinfo | grep 'vmx\|svm'
# On OSX
sysctl -a | grep machdep.cpu.features | grep VMX

Installation

Minikube is a single binary. Thus, installation is as easy as downloading the binary and placing it in your path.

# Specify the version of minikube to download.
# Latest version can be retrieved from 
# https://github.com/kubernetes/minikube/releases
VERSION=v0.16.0

# If on Linux
OS=linux  
# If on OSX
# OS=darwin

# URL to download minikube binary from
URL=https://storage.googleapis.com/minikube/releases/$VERSION/minikube-$OS-amd64

# Download binary and place in path.
curl -Lo minikube $URL 
chmod +x minikube 
sudo mv minikube /usr/local/bin/

Usage

To start a new cluster:

minikube start

This will create a new cluster of local virtual machines with Kubernetes already installed and configured.

You can access the Kubernetes dashboard with:

minikube dashboard

Minikube creates a related context for kubectl which can be used with:

kubectl config use-context minikube

Once ready the local Kubernetes can be used:

kubectl run hello-minikube --image=gcr.io/google_containers/echoserver:1.4 --port=8080
kubectl expose deployment hello-minikube --type=NodePort
curl $(minikube service hello-minikube --url)

To stop the local cluster:

minikube stop

To delete the local cluster, note new IP will be allocated after creation:

minikube delete