Over to minikube again

This is write up on minikube usage for my future self. I was using minikube for almost a year(~2018) but with the ‘none’ driver, i.e, the docker backend since the using the VM was quite heavy on my machine and also it had issues with sharing the images between the cluster and the development machine.

I was quite happy with the setup except for the fact whenever i switched network i had to restart the minikube again, I didn’t figure out a solution for that. But it was annoying, as often i work from both home and office.

Slowly, I lost interest with that setup and started to use K3s(rancher) thing and it was quite nice.But it also had its limitations.

As usual test cluster don’t offer freedom. Freedom is a hard compromise, so i came back to this setup again, to see probably the improvements have made it better.

Lets do it!

Install

We will download and install the latest minikube, also remember I will use docker backend, incase you have to use a hypervisor check the installation guide and pick the suitable one.

 curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 \
  && chmod +x minikube
  sudo minikube /usr/local/bin/minikube
  minikube version

See the installation guide

Start

Now that we have installed,let us try to start it. Beware, if you have a KUBECONFIG value it might update the minikube’s context to that current kubeconfig file and change the current context.

If want to avoid that, may be start with unsetting the KUBECONFIG variable.

    minikube start --driver=docker --kubernetes-version=v1.17.3 --cpus=2 --memory=4g

I want to use the docker driver and want to have a specific kubernetes version instead of the default latest version.

Check

First let us check if the service is up

    minikube status

Output

    minikube
    type: Control Plane
    host: Running
    kubelet: Running
    apiserver: Running
    kubeconfig: Configured

That should be easy and should make you happy

Use

Now test if we can really use the service,

    kubectl create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.10
    kubectl expose deployment hello-minikube --type=NodePort --port=8080
    kubectl get pod
    kubectl get svc

As the sevice is exposed as NodePort, we can ask minikube to get address of the service.

    minikube service hello-minikube --url

Issues

I had to use ImageSecrets for pulling the images(secure registries) that is exactly what i wanted, so i tried to run some of the charts in our current development and it was working.

But probably, i need to restart the minikube with more cpu & memory.

Also remember there could be containers asking for more cpu/memory which could fail, so if there are crashbackloop due to memory check the helm manifest and adjust the resource values.