CodeBlanks Logo Icon CodeBlanks

What is Minikube?

Learn that Minikube is a local Kubernetes cluster.

What is Minikube?

Minikube is a tool that runs a single-node (or, if you want, multi-node) Kubernetes cluster on your own computer. It's ideal for learning and local development. It sets up the cluster inside a Docker container or a virtual machine; this is called the driver.

Similar tools: kind (Kubernetes in Docker, popular in CI), k3d, Docker Desktop's built-in Kubernetes.

minikube start --driver=docker
kubectl get nodes
# minikube   Ready   control-plane   30s   v1.31.2

Using local images

The Minikube cluster uses its own container runtime; it doesn't automatically see an image you built on your computer. There are two ways:

minikube image load api:1.0          # copy the local image into the cluster
eval $(minikube docker-env)          # in this shell, docker commands go to Minikube's Docker
docker build -t api:1.0 .            # build directly inside the cluster

Then imagePullPolicy: IfNotPresent is used in the pod definition so it doesn't try to pull from a registry.

Practice Work with a local image

Write three commands: build api:1.0 from the current folder; load it into Minikube; create a deployment named api with the api:1.0 image.

Starter code

terminal
# buraya yaz

Sample solution

terminal
docker build -t api:1.0 .
minikube image load api:1.0
kubectl create deployment api --image=api:1.0

Expected output

[+] Building 5.2s (10/10) FINISHED
 => naming to docker.io/library/api:1.0 done
deployment.apps/api created

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 Which roles does the single node take on in Minikube?

  • None; it runs in the cloud
  • Both control plane and worker Correct answer
  • Only worker
  • Only control plane

Explanation: Both roles are combined on one machine.

2 Load a local image into Minikube.

Question
minikube image ____ api:1.0
Answer
minikube image load api:1.0

Explanation: image load transfers the local image into the cluster runtime.

3 Match.

Term Meaning
minikube Local K8s cluster
kind K8s in Docker
--driver=docker Set up inside a container
image load Transfer a local image

All lessons in Intermediate