minikube wrapper – kubernetes

What is minikube?

Minikube was developed to allow users to run Kubernetes LOCALLY. When you run minikube it will launch a minikube host as a container/VM depending on the driver and runs a single-node k8s cluster.

Why minikube?

Previously whenever I needed to test anything in the kubernetes environment I would stand up a full suite of servers 4 actually, 3 workers and 1 master node on a VM and it was very time-consuming to set up and use and also resource-intensive for my tiny home lab. I needed a way to create an environment fast and make it re-producible for testing purposes. LOCALLY is in CAPS above to show that the minikube environment is only accessible from the host that runs minikube and will not be accessible via the LAN, so it’s best to run it from a workstation such as macOS or a Linux workstation capable of running GUI for a browser. You can run it from a Linux server without a GUI but you would need to ssh tunnel to get to the external IP’s assigned to various services.
If you are interested in installing vanilla k8s on bare-metal you can look on my old post.

For this article I will be using docker driver for linux and hyperkit for macOS, for some of you, you might have virtualbox already installed and you can use that as your driver or any of the other drivers that minikube supports. The wrapper will not install docker in linux, however it is very easy to install docker. hyperkit comes installed on macOS so nothing else is needed.


I created a wrapper script to automate minikube so that once the startup is done your k8s environment is ready to go with a LoadBalancer with a pool of IP and a default storageClass for storage.

  • The wrapper will install minikube and kubectl if its not installed
  • The wrapper has options to start/stop/delete the minikube environment
  • The wrapper will auto detect CPU cores and memory and use half of your systems resources. You can overwrite this by editing the script and adding your own settings in the user editable section


$ curl -fsSL https://raw.githubusercontent.com/jlim0930/scripts/master/kube.sh -o kube.sh
$ chmod +x kube.sh


$ ./kube.sh start # starts the minikube environment might prompt you for sudo password

If you want to set a hard limit for CPU and memory you can edit kube.sh to set it or else it will set CPU to be half of your total # of cores and memory as half of your total memory up to 16GB. It will create a LoadBalancer IP pool which can be used for your deployments to be accessed locally. It will also create a default storageClass. Since this script creates the storageClass and LoadBalancer your kubernetes environment will be more like something you will find on most cloud providers. After this command is finished your kubernetes environment is up and running and ready to deploy your deployments for various projects.


$ ./kube.sh delete # deletes minikube environment

minikube & kubectl cheatsheet

Name Command
Start a cluster minikube start --driver=[docker\|hyperkit\|virtualbox]
Stop a cluster minikube stop
Get status minikube status
SSH into minikube host minikube ssh
Visit the dashboard minikube dashboard
Get IP minikube ip
Get minikube logs minikube logs
Mount host OS mount to minikube minikube mount /host-mount-point:minikube-mount-point
Configure minikube machine minikube config --memory <value> --cpus=<value>
Configure k8s version minikube config --kubernetes-version <version>
Check for updates minikube update-check
List addons minikube addons list
Enable addons minikube addons enable <addon name>
Disable addons minikube addons disable <addon name>
Proxy to a cluster service minikube service <service name>
Check cluster info kubectl cluster-info

Lets Play!

run kube.sh

$ curl -fsSL https://raw.githubusercontent.com/jlim0930/scripts/master/kube.sh -o kube.sh
$ ./kube.sh start
[DEBUG] minikube found.
[DEBUG] kubectl found.
[DEBUG] build minikube
[DEBUG] CPU will be set to 4 cores
❗  These changes will take effect upon a minikube delete and then a minikube start
[DEBUG] MEM will be set to 16005mb
❗  These changes will take effect upon a minikube delete and then a minikube start
😄  minikube v1.19.0 on Centos 7.9.2009
✨  Using the docker driver based on existing profile
👍  Starting control plane node minikube in cluster minikube
🏃  Updating the running docker "minikube" container ...
🐳  Preparing Kubernetes v1.20.2 on Docker 20.10.5 ...
🔎  Verifying Kubernetes components...
    ▪ Using image metallb/speaker:v0.8.2
    ▪ Using image metallb/controller:v0.8.2
    ▪ Using image gcr.io/k8s-minikube/storage-provisioner:v5
🌟  Enabled addons: storage-provisioner, metallb, default-storageclass
🏄  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
    ▪ Using image metallb/speaker:v0.8.2
    ▪ Using image metallb/controller:v0.8.2
🌟  The 'metallb' addon is enabled
[DEBUG] minikube IP is:
[DEBUG] LoadBalancer Pool: -

So what just happened? the script checked for minikube and kubectl binary and if not installed installed it. Set the # of cores and memroy and started the minikube environment. On linux it defaults to dockers and for macos it defaults to hyperkit(the default virtualization built into macos). Configured the loadbalancer and echoed out the pool.

$ kubectl cluster-info
Kubernetes control plane is running at
KubeDNS is running at

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

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

If you want to look at your k8s dashboard you can run minikube dashboard and it will open a browser with the dashboard loaded. Please use another tab to run this since you will need the session alive to view the dashboard.

Thats a wrap!

Your k8s environment is up now so you can start with your k8s projects!



Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.