Single node k8s cluster with Minikube

Minikube offers one of the easiest zero to dev experience to setup a single node kubernetes cluster. Its also the ideal way to create a local dev environment to test kubernetes code on.

This document explains how to setup and work with single node kubernetes cluster with minikube.

Install Minikube

Instructions to install minikube may vary based on the operating system and choice of the hypervisor. This is the official document which explains how to install minikube.

Start all in one single node cluster with minikube

<code>minikube <strong>status</strong>
</code>
		

[output]

<code><span class="hljs-label">minikube:</span>
<span class="hljs-label">cluster:</span>
<span class="hljs-label">kubectl:</span>
</code>
		
<code>minikube <span class="hljs-operator"><strong>start</strong>
</span></code>
		

[output]

<code>Starting <span class="hljs-built_in">local</span> Kubernetes v1<span class="hljs-built_in">.8</span><span class="hljs-built_in">.0</span> cluster<span class="hljs-attribute">...</span>
Starting VM<span class="hljs-attribute">...</span>
Getting VM IP address<span class="hljs-attribute">...</span>
Moving files <strong>into</strong> cluster<span class="hljs-attribute">...</span>
Setting up certs<span class="hljs-attribute">...</span>
Connecting <strong>to</strong> cluster<span class="hljs-attribute">...</span>
Setting up kubeconfig<span class="hljs-attribute">...</span>
Starting cluster components<span class="hljs-attribute">...</span>
Kubectl is now configured <strong>to</strong> use the cluster<span class="hljs-built_in">.
</span>Loading cached images from config file<span class="hljs-built_in">.
</span></code>
		
<code>minikube <strong>status</strong>
</code>
		

[output]

<code><span class="hljs-attribute">minikube</span>: <span class="hljs-string">Running</span>
<span class="hljs-attribute">cluster</span>: <span class="hljs-string">Running</span>
<span class="hljs-attribute">kubectl</span>: <span class="hljs-string">Correctly Configured: pointing to minikube-vm at 192.168.99.100</span>
</code>
		

Launch a kubernetes dashboard

<code><strong>minikube</strong> dashboard
</code>
		

Setting up docker environment

<code>minikube docker-env
<strong>export</strong> DOCKER_TLS_VERIFY=<span class="hljs-string">"1"</span>
<strong>export</strong> DOCKER_HOST=<span class="hljs-string">"tcp://192.168.99.100:2376"</span>
<strong>export</strong> DOCKER_CERT_PATH=<span class="hljs-string">"/Users/gouravshah/.minikube/certs"</span>
<strong>export</strong> DOCKER_API_VERSION=<span class="hljs-string">"1.23"</span>
# Run <strong>this</strong> command to configure your shell:
# <span class="hljs-built_in">eval</span> $(minikube docker-env)
</code>
		

Run the command given above, e.g.

<code><strong>eval</strong> <span class="hljs-variable">$(</span>minikube docker-<strong>env</strong>)
</code>
		

Now your docker client should be able to connect with the minikube cluster

<code>docker <strong>ps</strong>
</code>
		

Additional Commands

<code>minikube ip
minikube <strong>get</strong>-k8s-versions
minikube logs
</code>