How to Install Minikube on Ubuntu 22.04 | 20.04
Minikube is a popular tool for developers looking to create a local Kubernetes cluster on their machine. This guide will walk you through the installation of Minikube on Ubuntu 22.04 and 20.04. We will cover all necessary steps, from system preparation to running your first Kubernetes cluster, ensuring you have a smooth setup process.
Table of Contents
- Introduction
- Prerequisites
- Step 1: Update Your System
- Step 2: Install Required Packages
- Step 3: Install Docker
- Step 4: Install kubectl
- Step 5: Install Minikube
- Step 6: Start Minikube
- Step 7: Verify Minikube Installation
- Conclusion
Introduction
Minikube is a lightweight Kubernetes implementation that creates a VM on your local machine and deploys a simple cluster containing only one node. This is ideal for developers who want to try out Kubernetes or develop with it daily. Installing Minikube on Ubuntu 22.04 and 20.04 is straightforward, and this guide will show you how.
Prerequisites
Before we begin, ensure you have the following:
- A machine running Ubuntu 22.04 or 20.04
- At least 2GB of RAM and 20GB of disk space available
- A user account with sudo privileges
- Internet access
Step 1: Update Your System
First, it's always a good idea to update your system to ensure all existing packages are up-to-date. Open your terminal and run the following commands:
sudo apt update
sudo apt upgrade -y
Step 2: Install Required Packages
Minikube requires a few packages to be installed on your system. These include curl
, conntrack
, and apt-transport-https
. Install them with the following command:
sudo apt install -y curl apt-transport-https ca-certificates software-properties-common
Step 3: Install Docker
Minikube supports multiple container runtimes, but Docker is the most commonly used. To install Docker, follow these steps:
Add Docker’s official GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
Set up the stable repository:
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Install Docker Engine:
sudo apt update sudo apt install -y docker-ce docker-ce-cli containerd.io
Verify Docker Installation:
sudo systemctl status docker
Step 4: Install kubectl
kubectl
is the command-line tool for interacting with Kubernetes clusters. Install kubectl
by following these steps:
Download the latest release:
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
Install kubectl:
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
Verify kubectl installation:
kubectl version --client
Step 5: Install Minikube
Now it's time to install Minikube. Follow these steps:
Download the latest Minikube release:
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
Install Minikube:
sudo install minikube-linux-amd64 /usr/local/bin/minikube
Verify Minikube installation:
minikube version
Step 6: Start Minikube
With Minikube installed, you can now start your Kubernetes cluster. Use the following command to start Minikube with Docker as the driver:
minikube start --driver=docker
Minikube will download the necessary images and set up the cluster. This might take a few minutes.
Step 7: Verify Minikube Installation
To ensure Minikube is running correctly, check the status of the cluster:
minikube status
You should see output indicating that the cluster is running. Additionally, you can run a test deployment to confirm everything is working:
Create a deployment:
kubectl create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.4
Expose the deployment:
kubectl expose deployment hello-minikube --type=NodePort --port=8080
Get the URL to access the service:
minikube service hello-minikube --url
Open the URL in your browser:
curl $(minikube service hello-minikube --url)
You should see a response from the echo server, indicating that your Minikube cluster is functioning correctly.
Conclusion
Installing Minikube on Ubuntu 22.04 and 20.04 is a straightforward process if you follow these steps. By setting up Minikube, you now have a powerful tool to develop, test, and experiment with Kubernetes locally. Enjoy exploring Kubernetes and building your containerized applications!
Compelling Summary: Minikube installation on Ubuntu 22.04 | 20.04 enables a local Kubernetes cluster setup, perfect for development and testing. Follow these steps to get started efficiently.
References
This guide ensures a smooth and comprehensive setup process, helping developers quickly start with Kubernetes on their local machines.