Step-by-Step Guide to Installing Kubernetes with Minikube on Ubuntu 20.04

Minikube is a robust, open-source tool that simplifies the process of setting up a single-node
Kubernetes cluster on your local machine. It streamlines the development environment, allowing you to
run Kubernetes seamlessly on macOS, Linux, and Windows.

In this tutorial, we will guide you through the installation of Minikube on an Ubuntu 20.04 server.

Prerequisites

  • Ubuntu 20.04 desktop installed on your system.
  • Minimum of 4 GB of RAM and a dual-core CPU or more.
  • Ensure hardware virtualization is enabled on your machine.
  • Configured root password for the server.

Getting Started

Begin by updating your system packages to their latest versions. Execute the following command:

apt-get update -y

After updating, install necessary dependencies using the command below:

apt-get install curl wget apt-transport-https virtualbox virtualbox-ext-pack -y

Install Docker

Docker is vital for Minikube. Install it using:

apt-get install docker.io -y

Start the Docker service and enable it to launch during system boot:

systemctl start docker
systemctl enable docker

Verify the Docker version:

docker --version

Expected output:

Docker version 19.03.8, build afacb8b7f0

Install Minikube

Minikube is not part of the default Ubuntu repositories. Download it from the official site:

 wget https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64

Copy the binary to your system’s PATH:

cp minikube-linux-amd64 /usr/local/bin/minikube

Set execution permissions:

chmod 755 /usr/local/bin/minikube

Check the Minikube version:

minikube version

Expected output:

minikube version: v1.16.0
commit: 9f1e482427589ff8451c4723b6ba53bb9742fbb1

Install Kubectl

Install Kubectl for Kubernetes management. Add the GPG key first:

curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -

Add the repository:

echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | tee /etc/apt/sources.list.d/kubernetes.list

Update the cache and install Kubectl:

apt-get update -y
apt-get install kubectl kubeadm kubectl -y

Start Minikube

Now start Minikube:

minikube start

Expected output includes the status and configuration notes:

        * minikube v1.16.0 on Ubuntu 20.04 (kvm/amd64)
        * Using the none driver based on user configuration
        * Starting control plane node minikube in cluster minikube
        * Running on localhost...
        * Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default

Verify the cluster information:

kubectl cluster-info

Expected output:

Kubernetes control plane is running at https://45.58.38.77:8443...

Access Kubernetes Dashboard

Use Minikube’s addons. To list them, run:

minikube addons list

Expected output:

|-----------------------------|----------|--------------|
|         ADDON NAME          | PROFILE  |    STATUS    |
|-----------------------------|----------|--------------|
...

To access the dashboard, enable it using:

minikube dashboard --url

Expected output:

* Enabling dashboard ...
* Verifying dashboard health ...
* Launching proxy ...
http://127.0.0.1:36499/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/

Conclusion

This guide has shown you how to install Minikube and use it to set up a Kubernetes cluster on Ubuntu
20.04. With this setup, you can now efficiently manage your Kubernetes cluster in a local environment.

Frequently Asked Questions (FAQ)

1. What is Minikube?

Minikube is a tool that allows you to run Kubernetes locally. It creates a single-node Kubernetes cluster on your computer.

2. Can Minikube run on macOS and Windows?

Yes, Minikube is cross-platform and can run on Windows, macOS, and Linux.

3. Why do I need Docker for Minikube?

Docker provides the container runtime that Kubernetes uses to run applications, even when using Minikube for local clusters.

4. How do I access the Kubernetes Dashboard?

Once Minikube is set up, execute the command minikube dashboard --url to get the URL for accessing the Kubernetes Dashboard via your web browser.

5. What should I do if I encounter issues during installation?

Ensure all prerequisites are met, such as enabling hardware virtualization, and verify each command for accuracy.