DEV Community

Cover image for Minikube installation | Kubernetes Tutorial
jmbharathram
jmbharathram

Posted on

1 1

Minikube installation | Kubernetes Tutorial

If you're either working on Kubernetes as part of your job or learning Kubernetes, you will need access to a development / test Kubernetes cluster. Where you can just play without worrying about messing it up.

I have been aware of Minikube for a while because I regularly see it being mentioned in Kubernetes documentation. By the way, if you don't know, you can use Minikube to quickly stand up your own local single-node Kubernetes cluster on your laptop or desktop.

I decided to try it out as well and document my experience for both myself and you, the reader. So here we go.

Note: Your commands' outputs might look different.

Minikube Installation

I followed the instructions from this doc: minikube start | minikube (k8s.io)

One of the main requirements for installing Minikube is a Hypervisor or virtual machine manager.

I tried using Docker first, but the installation kept failing. I'll attach a screenshot of the error at the end of the article.

Install Hyperkit

Then I decided to use Hyperkit, which I installed using the below brew command.

~ % brew install hyperkit
==> Downloading https://ghcr.io/v2/homebrew/core/hyperkit/manifests/0.20200908
Already downloaded: /Users/bharathram.manoharan/Library/Caches/Homebrew/downloads/db4baa34ee2a779e1db4861dd34db8b2fc91786b2b7d32775b5e5de7f47af42a--hyperkit-0.20200908.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/hyperkit/blobs/sha256:26a203b17733ff5166d8c31069e3ecd5af15c74448a51d8b682689cb07e911e8
Already downloaded: /Users/bharathram.manoharan/Library/Caches/Homebrew/downloads/0ba7a770088a60dd6275860b0407ad95191aa6ddde0207b446e17a144b0e7a33--hyperkit--0.20200908.catalina.bottle.tar.gz
==> Pouring hyperkit--0.20200908.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/hyperkit/0.20200908: 5 files, 4.3MB
==> `brew cleanup` has not been run in the last 30 days, running now...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
Removing: /Users/bharathram.manoharan/Library/Caches/Homebrew/yq--4.25.1... (3.0MB)
Removing: /Users/bharathram.manoharan/Library/Logs/Homebrew/oniguruma... (64B)
Removing: /Users/bharathram.manoharan/Library/Logs/Homebrew/jq... (64B)

Install kubectl locally

I prefer installing kubectl on my local machine, even though minikube itself contains kubectl as well, just so I can work with not just this minikube cluster but the other Kubernetes clusters (EKS, My AWS Lab environment etc.)

brew install kubectl

Install Minikube

~ % brew install minikube
==> Downloading https://ghcr.io/v2/homebrew/core/minikube/manifests/1.25.2
Already downloaded: /Users/bharathram.manoharan/Library/Caches/Homebrew/downloads/fa0034afe1330adad087a8b3dc9ac4917982d248b08a4df4cbc52ce01d5eabff--minikube-1.25.2.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/minikube/blobs/sha256:888a850d809aa5c62c3e3ccb40b059faf52a4519881f08bf93ec1267558b622e
Already downloaded: /Users/bharathram.manoharan/Library/Caches/Homebrew/downloads/bd6123a468a67f63dd664bec951b99b78c45f2eabe18150eeaafb7ddd3ff4827--minikube--1.25.2.monterey.bottle.tar.gz
==> Pouring minikube--1.25.2.monterey.bottle.tar.gz
==> Caveats
zsh completions have been installed to:
  /usr/local/share/zsh/site-functions
==> Summary
🍺  /usr/local/Cellar/minikube/1.25.2: 9 files, 72.3MB
==> Running `brew cleanup minikube`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

(Optional) Set a memory limit for minikube (set a limit according to your system's capacity)

~ % minikube config set memory 8g
❗  These changes will take effect upon a minikube delete and then a minikube start

Start minikube with Hyperkit as driver

~ % minikube start --driver=hyperkit
πŸ˜„  minikube v1.25.2 on Darwin 12.4
✨  Using the hyperkit driver based on user configuration
πŸ‘  Starting control plane node minikube in cluster minikube
πŸ”₯  Creating hyperkit VM (CPUs=2, Memory=8192MB, Disk=20000MB) ...
🐳  Preparing Kubernetes v1.23.3 on Docker 20.10.12 ...
    β–ͺ kubelet.housekeeping-interval=5m
    β–ͺ Generating certificates and keys ...
    β–ͺ Booting up control plane ...
    β–ͺ Configuring RBAC rules ...
πŸ”Ž  Verifying Kubernetes components...
    β–ͺ Using image gcr.io/k8s-minikube/storage-provisioner:v5
🌟  Enabled addons: storage-provisioner, default-storageclass
πŸ„  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default

Verify the minikube installation

 ~ % kubectl config get-contexts minikube
CURRENT   NAME       CLUSTER    AUTHINFO   NAMESPACE
*         minikube   minikube   minikube   default

~ % kubectl get nodes
NAME       STATUS   ROLES                  AGE   VERSION
minikube   Ready    control-plane,master   11m   v1.23.3

Stop minikube when not needed

~ % minikube stop
βœ‹  Stopping node "minikube"  ...
πŸ›‘  1 node stopped.

Appendix

When I used Docker as the driver of my minikube while starting my cluster, I got the below error.

~ % minikube start --driver=docker
πŸ˜„  minikube v1.25.2 on Darwin 12.4
✨  Using the docker driver based on user configuration
πŸ‘  Starting control plane node minikube in cluster minikube
🚜  Pulling base image ...
πŸ”₯  Creating docker container (CPUs=2, Memory=8192MB) ...
❗  This container is having trouble accessing https://k8s.gcr.io
πŸ’‘  To pull new external images, you may need to configure a proxy: https://minikube.sigs.k8s.io/docs/reference/networking/proxy/
🐳  Preparing Kubernetes v1.23.3 on Docker 20.10.12 ...- E0604 17:30:28.313962   78446 start.go:126] Unable to get host IP: resolve dns to ip: docker exec -t minikube dig +short host.docker.internal: exit status 9
stdout:
;; connection timed out; no servers could be reached


stderr:

    β–ͺ kubelet.housekeeping-interval=5m
    β–ͺ Generating certificates and keys ...
    β–ͺ Booting up control plane ...
    β–ͺ Configuring RBAC rules ...
πŸ”Ž  Verifying Kubernetes components...
    β–ͺ Using image gcr.io/k8s-minikube/storage-provisioner:v5
🌟  Enabled addons: storage-provisioner, default-storageclass
πŸ„  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default

Resources:

minikube start | minikube (k8s.io)

Install and Set Up kubectl on macOS | Kubernetes

hyperkit | minikube (k8s.io)

Image of Timescale

πŸš€ pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applicationsβ€”without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post β†’

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

AWS GenAI Live!

GenAI LIVE! is a dynamic live-streamed show exploring how AWS and our partners are helping organizations unlock real value with generative AI.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❀️