Skip to main content
Kubernetes

Install and Setup MiniKube on Ubuntu

Deploy Kubernetes cluster on your local Ubuntu system with minikube and start exploring Kubernetes.

LHB Community

Kubernetes is an in-demand skill. Learning it can help you land a lucrative job offer.

For developers or students who are just starting to learn Kubernetes and explore its features, the challenge is that you may not be able to afford a real test server setup to test and learn.

Sure, cloud servers like Linode and DigitalOcean provide easy Kubernetes deployment but it costs money and not everyone can afford that.

DigitalOcean – The developer cloud
Helping millions of developers easily build, test, manage, and scale applications of any size – faster than ever before.

Get started on DigitalOcean with a $100, 60-day credit for new users.

A better solution is to install and use a Kubernetes cluster locally without needing to pay any extra money just to learn and test.

And that's where MiniKube comes into picture.

What is Minikube?

Minikube or mini-Kubernetes is a Kubernetes cluster that allows you to run a single node Kubernetes cluster locally for developing and testing purposes. It's easy to install, and behind the scenes, it runs Kubernetes on a virtual machine (VM) using a hypervisor like VirtualBox or Hyper-V.

📋
An alternative to Minikube is Kind. Kind runs Kubernetes inside a Docker container and lets you run run multiple containers, but it needs more resources compared to Minikube.

Requirements to Install Minikube on Ubuntu

Before you start the installation, you should know a few things on the requirement.

As you'll use Docker in this tutorial, you need to have Docker installed on your machine.

Minikube needs some disk space (20 GB or more) to host Docker containers,

And lastly, Minikube takes some memory, so make sure your computer has 4 GB or more RAM to use it smoothly.

Installing Minikube on Ubuntu

Please ensure that the package cache is updated.

sudo apt update

Next, install Curl and apt-transport-https with the following command:

sudo apt install -y curl apt-transport-https

Curl is a tool that allows to request data over a URL, and apt-transport-https allows to download and access repositories using the secure HTTP protocol (HTTPS).

Now you are ready. The next step is to download the latest Minikube binary files using:

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

Then install it with:

sudo install minikube-linux-amd64 /usr/local/bin/minikube

To verify that we installed Minikube successfully, we can check the version by the command:

minikube version
Check Minikube version

Install Kubectl

Kubectl is a CLI (Command Line Interface) tool to interact with the Kubernetes cluster. It is used to deploy and manage applications running on a Kubernetes cluster.

To install Kubectl, first, as usual, update the system and install the CA certificate:

sudo apt update && sudo apt install ca-certificates

Add Google Cloud's public signing key:

sudo curl -fsSLo /etc/apt/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg

Add the Kubernetes APT repository:

echo "deb [signed-by=/etc/apt/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list

Next, update the system and install Kubectl:

sudo apt update && sudo apt install -y kubectl

Congratulations! You have just installed Kubectl. Verify it:

kubectl version --client --short
Check Kubectl version

Start Minikube

Check the status of Minikube if it's started or not:

minikube status
Check minikube status

In this case, Minikube is stopped so you need to start it with the command:

minikube start
Start minikube

Use Minikube Dashboard

You can use the command minikube dashboard to launch Minikube Dashboard, which is a web interface that is used to manage Kubernetes clusters.

You can scale up or down deployments, and add or delete as many instances as the application needs.

Minikube dashboard

The dashboard will show us all the Kubernetes components that you can manage from the web interface.

Conclusion

This guide was a quick introduction to how you can install and use Minikube on an Ubuntu Linux system.

With Minikube, developers and students can explore the features and capabilities of Kubernetes without incurring additional costs, making it an ideal solution for those who want to learn and test Kubernetes in a development or testing environment.

✍️
The tutorial has been contributed by Mead Naji, a web developer and an old-school Linux developer.
LHB Community