Random   •   Archives   •   RSS   •   About   •   Contact


Minikube allows you to run a self contained, single node, Kubernetes cluster on your workstation. Once installed and configured, you may use kubectl to interact with it, just like a production Kubernetes cluster.

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


Requirements: Virtualbox

install kubectl

Reference: https://kubernetes.io/docs/tasks/kubectl/install/

curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/darwin/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin

install minikube

Reference: https://github.com/kubernetes/minikube/releases

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


Supported hypervisors: virtualbox, vmwarefusion, kvm, xhyve

minikube start --vm-driver=virtualbox

If this is your first time starting minikube, it will perform the following:

Starting local Kubernetes cluster...
Starting VM...
Downloading Minikube ISO 89.24 MB / 89.24 MB [==============================================] 100.00% 0s
SSH-ing files into VM...
Setting up certs...
Starting cluster components...
Connecting to cluster...
Setting up kubeconfig...
Kubectl is now configured to use the cluster

Also, you should see a new VM running in VirtualBox, like this:

virtualbox running minikube.

To verify that kubectl is configured to use minikube look at the config file (~/.kube/config).

Also try running:

  • kubectl get nodes
  • kubectl get services

You can also connect to the VirtualBox guest using SSH to have a look around. In my case the Minikube VM was assigned

ssh -i ~/.minikube/machines/minikube/id_rsa docker@

You can see all the containers running with:

docker ps
ps aux

Exit out, you really don't need to interact at this level

Instead we will treat Minikube as a "real" Kubernetes cluster and only use the kubectl tool.


create a deployment

In this example we create an echoserver cluster.

kubectl run hello-minikube --image=gcr.io/google_containers/echoserver:1.4 --port=8080

this command will create -

1 deployment:

kubectl get deployments

1 replicaset:

kubectl get replicasets

1 pods:

kubectl get pods

To make the echoserver accessible externally, you need to expose the deployment, like this:

kubectl expose deployment hello-minikube --type=NodePort

The expose command creates -

1 service:

kubectl get services
NAME            CLUSTER-IP   EXTERNAL-IP   PORT(S)          AGE
kubernetes     <none>        443/TCP          2d
hello-minikube   <nodes>       4444:31136/TCP   58m

To access the service, you connect to the Minikube's IP address on the exposed port.

In my case the Minikube VirtualBox IP is and the exposed port is 31136 as listed above.

The minikube tool has a shortcut for this info, try:

minikube service hello-minikube --url

Toss this into a web browser on your local machine and it should echo back!

scale a deployment

scale up the hello-minikube pod to 3:

kubectl scale deployment hello-minikube --replicas=3


kubectl get deployments
kubectl get pods

delete a deployment

trash this demo (delete the deployment, replicaset, pods, and service):

kubectl delete deployment hello-minikube

© Russell Ballestrini.