Installing Minikube on Ubuntu 24.04

|
Published:
|
|

If you are planning on getting started with Kubernetes, then installing Minikube on Ubuntu 24.04 might be the first step you want to take. Minikube is a lightweight tool used to implement a simple Kubernetes cluster on your local development system.

Kubernetes Concepts

If you are getting started with Kubernetes, you can have a look at the core Kubernetes concepts by following the link below.

What are the core concepts in Kubernetes?

Install Minikube on Ubuntu 24.04

Prerequisites

Below is a list of some of the hardware and software requirements for running Minikube on Ubuntu.

System Resources

Ensure your system has;

  • At least 2 CPUs
  • At least 2GB of free RAM
  • At least 20GB of free Disk space

Minikube Drivers

Drivers are components that Minikube uses to interact with various virtualization technologies used to run Kubernetes cluster. They can be a container or virtual machine manager, such asΒ Docker,Β QEMU,Β Hyperkit,Β Hyper-V,Β KVM,Β Parallels,Β Podman,Β VirtualBox, orΒ VMware Fusion/Workstation.

You can check how to install Docker, VirtualBox or KVM on Ubuntu 24.04 by following the links below;

How to Install Docker CE on Ubuntu 24.04

Install VirtualBox 7 on Ubuntu 24.04

Install KVM on Ubuntu 24.04

In this tutorial, we will use Docker driver with Minikube.

Internet Access

Ensure the system has Internet connection. This is required to download various Minikube components.

Install Kubectl

Minikube ships with kubectl integrated already (minikube kubectl β€” <kubectl command line options>).

While this is not entirely necessary, you can just install it by running the commands below.

curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl

Verify the kubectl version;

kubectl version --client --output=yaml
clientVersion:
  buildDate: "2023-10-18T11:42:52Z"
  compiler: gc
  gitCommit: a8a1abc25cad87333840cd7d54be2efaf31a3177
  gitTreeState: clean
  gitVersion: v1.28.3
  goVersion: go1.20.10
  major: "1"
  minor: "28"
  platform: linux/amd64
kustomizeVersion: v5.0.4-0.20230601165947-6ce0bf390ce3

As already mentioned, you can use the kubectl that ships with Minikube

(Run the command after installing Minikube)

minikube kubectl -- version --client -o yaml

Install Minikube

You can easily install Minikube by running the command;

curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube_latest_amd64.deb
sudo apt install ./minikube_latest_amd64.deb

Confirm the installation by checking the version of installed Minikube;

minikube version

Sample output;

minikube version: v1.32.0
commit: 8220a6eb95f0a4d75f7f2d7b14cef975f050512d

Start Minikube

We are running the next commands with a non root user;

su - kifarunix

Add your user to Docker group;

sudo usermod -aG docker $USER

Log out and login as user again

Ensure you are part of the Docker group;

id
uid=1000(kifarunix) gid=1000(kifarunix) groups=1000(kifarunix),100(users),992(docker),995(vboxsf)

Minikube Help Page

Run the command below to check Minikube help information;

minikube --help

minikube provisions and manages local Kubernetes clusters optimized for development workflows.

Basic Commands:
  start            Starts a local Kubernetes cluster
  status           Gets the status of a local Kubernetes cluster
  stop             Stops a running local Kubernetes cluster
  delete           Deletes a local Kubernetes cluster
  dashboard        Access the Kubernetes dashboard running within the minikube cluster
  pause            pause Kubernetes
  unpause          unpause Kubernetes

Images Commands:
  docker-env       Provides instructions to point your terminal's docker-cli to the Docker Engine inside minikube.
(Useful for building docker images directly inside minikube)
  podman-env       Configure environment to use minikube's Podman service
  cache            Manage cache for images
  image            Manage images

Configuration and Management Commands:
  addons           Enable or disable a minikube addon
  config           Modify persistent configuration values
  profile          Get or list the current profiles (clusters)
  update-context   Update kubeconfig in case of an IP or port change

Networking and Connectivity Commands:
  service          Returns a URL to connect to a service
  tunnel           Connect to LoadBalancer services

Advanced Commands:
  mount            Mounts the specified directory into minikube
  ssh              Log into the minikube environment (for debugging)
  kubectl          Run a kubectl binary matching the cluster version
  node             Add, remove, or list additional nodes
  cp               Copy the specified file into minikube

Troubleshooting Commands:
  ssh-key          Retrieve the ssh identity key path of the specified node
  ssh-host         Retrieve the ssh host key of the specified node
  ip               Retrieves the IP address of the specified node
  logs             Returns logs to debug a local Kubernetes cluster
  update-check     Print current and latest version number
  version          Print the version of minikube
  options          Show a list of global command-line options (applies to all commands).

Other Commands:
  completion       Generate command completion for a shell
  license          Outputs the licenses of dependencies to a directory

Use "minikube  --help" for more information about a given command.

Start Local Kubernetes cluster

You can show start Minikube local kubernetes cluster by running;

minikube start --driver=docker

So what does this command do?

  • It starts minikube control plane node in cluster.
  • Pulls the base images required to create a simple Kubernetes cluster
  • Next, it downloads preconfigured set of Kubernetes binaries to bootstrap the cluster.
  • Setup Kubernetes on Docker (VirtualBox is used as the default Minikube driver)
  • Configures container networking interface
  • Enable some Minikube add-ons such as for storage.

See sample output;

itnixpro@noble-numbat:~$ minikube start --driver=docker
πŸ˜„  minikube v1.32.0 on Ubuntu 24.04
✨  Using the docker driver based on user configuration
πŸ“Œ  Using Docker driver with root privileges
πŸ‘  Starting control plane node minikube in cluster minikube
🚜  Pulling base image ...
πŸ’Ύ  Downloading Kubernetes v1.28.3 preload ...
    > preloaded-images-k8s-v18-v1...:  403.35 MiB / 403.35 MiB  100.00% 34.57 M
    > gcr.io/k8s-minikube/kicbase...:  453.90 MiB / 453.90 MiB  100.00% 38.19 M
πŸ”₯  Creating docker container (CPUs=2, Memory=2200MB) ...
🐳  Preparing Kubernetes v1.28.3 on Docker 24.0.7 ...
    β–ͺ Generating certificates and keys ...
    β–ͺ Booting up control plane ...
    β–ͺ Configuring RBAC rules ...
πŸ”—  Configuring bridge CNI (Container Networking Interface) ...
    β–ͺ Using image gcr.io/k8s-minikube/storage-provisioner:v5
πŸ”Ž  Verifying Kubernetes components...
🌟  Enabled addons: default-storageclass, storage-provisioner
πŸ’‘  kubectl not found. If you need it, try: 'minikube kubectl -- get pods -A'
πŸ„  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default

Check Minikube Status

You can check Minikube status using the command below;

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

Administering Kubernetes on Minikube

The Minikube simple kubernetes cluster is now up!

Minikube SSH Login

Just like how you would login to a docker container with docker exec -it, command, you can SSH into Minikube container using the command below;

minikube ssh

You land into the the minikube docker shell.

Run docker commands inside;

docker ps
CONTAINER ID   IMAGE                       COMMAND                  CREATED          STATUS          PORTS     NAMES
887b10137478   6e38f40d628d                "/storage-provisioner"   13 minutes ago   Up 13 minutes             k8s_storage-provisioner_storage-provisioner_kube-system_229d2576-be37-45f4-8e2b-914b97e6a531_1
12cbc1a0d610   ead0a4a53df8                "/coredns -conf /etc…"   13 minutes ago   Up 13 minutes             k8s_coredns_coredns-5dd5756b68-nb75b_kube-system_449d5ef3-ff4e-4376-912b-8bb3d5694b34_0
0a3f880da164   bfc896cf80fb                "/usr/local/bin/kube…"   13 minutes ago   Up 13 minutes             k8s_kube-proxy_kube-proxy-fj4hh_kube-system_b508788b-d5e7-470a-a1e1-607bfc68bd13_0
676bca7c2953   registry.k8s.io/pause:3.9   "/pause"                 13 minutes ago   Up 13 minutes             k8s_POD_coredns-5dd5756b68-nb75b_kube-system_449d5ef3-ff4e-4376-912b-8bb3d5694b34_0
38783b3dc7dc   registry.k8s.io/pause:3.9   "/pause"                 13 minutes ago   Up 13 minutes             k8s_POD_kube-proxy-fj4hh_kube-system_b508788b-d5e7-470a-a1e1-607bfc68bd13_0
eb9c9724e81a   registry.k8s.io/pause:3.9   "/pause"                 13 minutes ago   Up 13 minutes             k8s_POD_storage-provisioner_kube-system_229d2576-be37-45f4-8e2b-914b97e6a531_0
d95f881c9586   537434729123                "kube-apiserver --ad…"   14 minutes ago   Up 14 minutes             k8s_kube-apiserver_kube-apiserver-minikube_kube-system_55b4bbe24dac3803a7379f9ae169d6ba_0
3b283c57d7e7   10baa1ca1706                "kube-controller-man…"   14 minutes ago   Up 14 minutes             k8s_kube-controller-manager_kube-controller-manager-minikube_kube-system_7da72fc2e2cfb27aacf6cffd1c72da00_0
40f7c0407d98   73deb9a3f702                "etcd --advertise-cl…"   14 minutes ago   Up 14 minutes             k8s_etcd_etcd-minikube_kube-system_9aac5b5c8815def09a2ef9e37b89da55_0
c5046b7d378d   6d1b4fd1b182                "kube-scheduler --au…"   14 minutes ago   Up 14 minutes             k8s_kube-scheduler_kube-scheduler-minikube_kube-system_75ac196d3709dde303d8a81c035c2c28_0
55bae56fd1cf   registry.k8s.io/pause:3.9   "/pause"                 14 minutes ago   Up 14 minutes             k8s_POD_kube-controller-manager-minikube_kube-system_7da72fc2e2cfb27aacf6cffd1c72da00_0
5f8a2f23d88e   registry.k8s.io/pause:3.9   "/pause"                 14 minutes ago   Up 14 minutes             k8s_POD_kube-apiserver-minikube_kube-system_55b4bbe24dac3803a7379f9ae169d6ba_0
b8b3522d0385   registry.k8s.io/pause:3.9   "/pause"                 14 minutes ago   Up 14 minutes             k8s_POD_etcd-minikube_kube-system_9aac5b5c8815def09a2ef9e37b89da55_0
bb8d527c26a5   registry.k8s.io/pause:3.9   "/pause"                 14 minutes ago   Up 14 minutes             k8s_POD_kube-scheduler-minikube_kube-system_75ac196d3709dde303d8a81c035c2c28_0

Check docker images;

docker images
REPOSITORY                                TAG       IMAGE ID       CREATED         SIZE
registry.k8s.io/kube-apiserver            v1.28.3   537434729123   5 months ago    126MB
registry.k8s.io/kube-controller-manager   v1.28.3   10baa1ca1706   5 months ago    122MB
registry.k8s.io/kube-scheduler            v1.28.3   6d1b4fd1b182   5 months ago    60.1MB
registry.k8s.io/kube-proxy                v1.28.3   bfc896cf80fb   5 months ago    73.1MB
registry.k8s.io/etcd                      3.5.9-0   73deb9a3f702   10 months ago   294MB
registry.k8s.io/coredns/coredns           v1.10.1   ead0a4a53df8   13 months ago   53.6MB
registry.k8s.io/pause                     3.9       e6f181688397   17 months ago   744kB
gcr.io/k8s-minikube/storage-provisioner   v5        6e38f40d628d   3 years ago     31.5MB
docker system df
TYPE            TOTAL     ACTIVE    SIZE      RECLAIMABLE
Images          8         8         752.4MB   4.057MB (0%)
Containers      15        14        162B      0B (0%)
Local Volumes   0         0         0B        0B
Build Cache     0         0         0B        0B

Exit when done;

exit

Get Kubernetes Cluster Resource Information

Let’s run a few Kubernetes commands;

Get Kubernetes cluster information;

minikube kubectl -- cluster-info
    > kubectl.sha256:  64 B / 64 B [-------------------------] 100.00% ? p/s 0s
    > kubectl:  47.56 MiB / 47.56 MiB [----------] 100.00% 197.12 MiB p/s 400ms
Kubernetes control plane is running at https://192.168.49.2:8443
CoreDNS is running at https://192.168.49.2:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

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

Lists all the nodes in the current namespace.

minikube kubectl -- get nodes
NAME       STATUS   ROLES           AGE   VERSION
minikube   Ready    control-plane   17m   v1.28.3

List all services in the current namespace;

minikube kubectl -- get services
NAME         TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
kubernetes   ClusterIP   10.96.0.1            443/TCP   18m

You can run other commands as you wish.

Deploy Simple Kubernets Application

Let’s create a simple Nginx manifest file to define the desired state;

vim nginx-deployment.yaml

Paste the following content;


apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:latest
        ports:
        - containerPort: 80

Deploy Nginx;

minikube kubectl -- apply -f nginx-deployment.yaml

List deployments;

minikube kubectl -- get deployments

NAME               READY   UP-TO-DATE   AVAILABLE   AGE
nginx-deployment   0/2     2            0           13s

Check the pods. You should see two of them due to replica of 2;

minikube kubectl -- get pods

NAME                                READY   STATUS    RESTARTS   AGE
nginx-deployment-6b7f675859-ljsh8   1/1     Running   0          7s
nginx-deployment-6b7f675859-qvnpn   1/1     Running   0          7s

Next, you need to expose this service for external access;

vim nginx-service.yaml

apiVersion: v1
kind: Service
metadata:
  name: nginx-service
spec:
  type: NodePort
  selector:
    app: nginx
  ports:
    - name: http
      port: 80
      targetPort: 80
      nodePort: 30000  # Choose an available port number

Ensure no other service is being exposed via port 31500/tcp defined above.

Apply the service;

minikube kubectl -- apply -f nginx-service.yaml

Check the services to find out an external port to access it;

minikube kubectl -- get services

NAME            TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE
kubernetes      ClusterIP   10.96.0.1               443/TCP        60m
nginx-service   NodePort    10.107.130.31           80:30000/TCP   3s

get more details;

minikube kubectl -- describe service nginx-service

Name:                     nginx-service
Namespace:                default
Labels:                   
Annotations:              
Selector:                 app=nginx
Type:                     NodePort
IP Family Policy:         SingleStack
IP Families:              IPv4
IP:                       10.107.130.31
IPs:                      10.107.130.31
Port:                     http  80/TCP
TargetPort:               80/TCP
NodePort:                 http  30000/TCP
Endpoints:                10.244.0.8:80,10.244.0.9:80
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   

Accessing the Service. You can print the url or open service on the default browser;

minikube kubectl -- service nginx-service

Sample browser;

Install Minikube on Ubuntu 24.04

and command line output;


|-----------|---------------|-------------|---------------------------|
| NAMESPACE |     NAME      | TARGET PORT |            URL            |
|-----------|---------------|-------------|---------------------------|
| default   | nginx-service | http/80     | http://192.168.49.2:30000 |
|-----------|---------------|-------------|---------------------------|
πŸŽ‰  Opening service default/nginx-service in default browser...

Unfortunately, our service is exposed via docker bridge interface IP and hence, makes it hard to access externally.

You can do port forwarding of Nginx target port to some other unused ports as follows;

minikube kubectl -- port-forward service/nginx-service --address=0.0.0.0 8080:80

Sample output;

Forwarding from 0.0.0.0:8080 -> 80
Handling connection for 8080
Handling connection for 8080

Press CTRL+C to cancel.

You should now be able to access your App outside Minikube cluster, http://<server-IP>:8080.

Install Minikube on Ubuntu 24.04

You can now proceed to explore Kubernetes!

Enable Minikube Addons

Addons are components that can be used to extend the functionality of Minikube;

There is quite a number of addons;

minikube addons list

|-----------------------------|----------|--------------|--------------------------------|
|         ADDON NAME          | PROFILE  |    STATUS    |           MAINTAINER           |
|-----------------------------|----------|--------------|--------------------------------|
| ambassador                  | minikube | disabled     | 3rd party (Ambassador)         |
| auto-pause                  | minikube | disabled     | Google                         |
| cloud-spanner               | minikube | disabled     | Google                         |
| csi-hostpath-driver         | minikube | disabled     | Kubernetes                     |
| dashboard                   | minikube | disabled     | Kubernetes                     |
| default-storageclass        | minikube | enabled βœ…   | Kubernetes                     |
| efk                         | minikube | disabled     | 3rd party (Elastic)            |
| freshpod                    | minikube | disabled     | Google                         |
| gcp-auth                    | minikube | disabled     | Google                         |
| gvisor                      | minikube | disabled     | Google                         |
| headlamp                    | minikube | disabled     | 3rd party (kinvolk.io)         |
| helm-tiller                 | minikube | disabled     | 3rd party (Helm)               |
| inaccel                     | minikube | disabled     | 3rd party (InAccel             |
|                             |          |              | [[email protected]])            |
| ingress                     | minikube | disabled     | Kubernetes                     |
| ingress-dns                 | minikube | disabled     | Google                         |
| istio                       | minikube | disabled     | 3rd party (Istio)              |
| istio-provisioner           | minikube | disabled     | 3rd party (Istio)              |
| kong                        | minikube | disabled     | 3rd party (Kong HQ)            |
| kubevirt                    | minikube | disabled     | 3rd party (KubeVirt)           |
| logviewer                   | minikube | disabled     | 3rd party (unknown)            |
| metallb                     | minikube | disabled     | 3rd party (MetalLB)            |
| metrics-server              | minikube | disabled     | Kubernetes                     |
| nvidia-driver-installer     | minikube | disabled     | Google                         |
| nvidia-gpu-device-plugin    | minikube | disabled     | 3rd party (Nvidia)             |
| olm                         | minikube | disabled     | 3rd party (Operator Framework) |
| pod-security-policy         | minikube | disabled     | 3rd party (unknown)            |
| portainer                   | minikube | disabled     | 3rd party (Portainer.io)       |
| registry                    | minikube | disabled     | Google                         |
| registry-aliases            | minikube | disabled     | 3rd party (unknown)            |
| registry-creds              | minikube | disabled     | 3rd party (UPMC Enterprises)   |
| storage-provisioner         | minikube | enabled βœ…   | Google                         |
| storage-provisioner-gluster | minikube | disabled     | 3rd party (Gluster)            |
| volumesnapshots             | minikube | disabled     | Kubernetes                     |
|-----------------------------|----------|--------------|--------------------------------|

You can enable an addon using the command;

minikube addons enable <name>

For example, enable Minikube dashboard;

minikube addons enable dashboard

πŸ’‘  dashboard is an addon maintained by Kubernetes. For any concerns contact minikube on GitHub.
You can view the list of minikube maintainers at: https://github.com/kubernetes/minikube/blob/master/OWNERS
    β–ͺ Using image docker.io/kubernetesui/dashboard:v2.7.0
    β–ͺ Using image docker.io/kubernetesui/metrics-scraper:v1.0.8
πŸ’‘  Some dashboard features require the metrics-server addon. To enable all features please run:

	minikube addons enable metrics-server	


🌟  The 'dashboard' addon is enabled

Also enable Metrics server;

minikube addons enable metrics-server

You can check the services for these addons on the kube-system namespace;

minikube kubectl -- get services --all-namespaces
NAMESPACE              NAME                        TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                  AGE
default                kubernetes                  ClusterIP   10.96.0.1                443/TCP                  27m
kube-system            kube-dns                    ClusterIP   10.96.0.10               53/UDP,53/TCP,9153/TCP   27m
kube-system            metrics-server              ClusterIP   10.109.17.235            443/TCP                  4m9s
kubernetes-dashboard   dashboard-metrics-scraper   ClusterIP   10.109.191.202           8000/TCP                 3m56s
kubernetes-dashboard   kubernetes-dashboard        ClusterIP   10.110.150.153           80/TCP                   3m56s

To access the dashboard externally;

minikube kubectl -- port-forward service/kubernetes-dashboard -n kubernetes-dashboard --address=0.0.0.0 8888:80

You dashboard is now availanle on http://minikube-server-IP:8888;

Explore the dashboard further.

Stop and Delete Minikube Profile

You can always stop and delete Minikube profile;

minikube profile list

Sample output;


|----------|-----------|---------|--------------|------|---------|---------|-------|--------|
| Profile  | VM Driver | Runtime |      IP      | Port | Version | Status  | Nodes | Active |
|----------|-----------|---------|--------------|------|---------|---------|-------|--------|
| minikube | docker    | docker  | 192.168.49.2 | 8443 | v1.26.3 | Running |     1 | *      |
|----------|-----------|---------|--------------|------|---------|---------|-------|--------|

Or get current profile;

minikube profile

Stop Minikube;

minikube stop

Delete current profile;

minikube delete

or specific profile;

minikube delete --profile <profile name>

See example;

minikube delete --profile minikube

πŸ”₯  Deleting "minikube" in docker ...
πŸ”₯  Deleting container "minikube" ...
πŸ”₯  Removing /home/kifarunix/.minikube/machines/minikube ...
πŸ’€  Removed all traces of the "minikube" cluster.

Or;

minikube delete --all --purge

And that concludes our guide on how to install Minikube on Ubuntu 24.04.

Further Reading

Read more on getting started with Minikube.

Other Tutorials;

Monitor Docker Swarm and Container metrics using Metricbeat

SUPPORT US VIA A VIRTUAL CUP OF COFFEE

We're passionate about sharing our knowledge and experiences with you through our blog. If you appreciate our efforts, consider buying us a virtual coffee. Your support keeps us motivated and enables us to continually improve, ensuring that we can provide you with the best content possible. Thank you for being a coffee-fueled champion of our work!

Photo of author
Kifarunix
Linux Certified Engineer, with a passion for open-source technology and a strong understanding of Linux systems. With experience in system administration, troubleshooting, and automation, I am skilled in maintaining and optimizing Linux infrastructure.

Leave a Comment