Kubernetes is a powerful platform for container orchestration, enabling developers to manage containerized applications across multiple hosts. Minikube is a lightweight Kubernetes implementation that lets you run Kubernetes clusters on a local machine. In this guide, we will walk through the steps to install and set up Kubernetes with Minikube on Ubuntu 20.04. If you’re using a Windows VPS UK, Minikube can also be installed in a virtualized environment on Windows-based systems.
Prerequisites
Before starting, ensure that you have:
- An Ubuntu 20.04 server or desktop with root or sudo access.
- At least 2GB of RAM and 2 CPUs for Minikube to run smoothly.
- Virtualization enabled on your system (for VirtualBox or KVM).
If you’re using VPS UK Windows or Windows VPS Italy, you can create a similar Kubernetes setup in a virtualized Windows environment.
Step 1: Install Virtualization Software
Minikube requires a hypervisor to run virtual machines. On Ubuntu, you can use either VirtualBox or KVM. Install VirtualBox with the following command:
sudo apt update
sudo apt install virtualbox -y
If you prefer KVM, you can install it using:
sudo apt install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils -y
Ensure virtualization is enabled on your machine by checking with:
egrep -c '(vmx|svm)' /proc/cpuinfo
If the output is greater than zero, virtualization is supported.
Step 2: Install Minikube
To install Minikube, first download the Minikube binary:
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
Make the binary executable and move it to your PATH:
sudo install minikube-linux-amd64 /usr/local/bin/minikube
Verify the installation:
minikube version
Step 3: Install kubectl
Kubernetes uses kubectl
to manage clusters. Install kubectl
with the following commands:
sudo apt update
sudo apt install -y apt-transport-https
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
sudo sh -c 'echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list'
sudo apt update
sudo apt install -y kubectl
Step 4: Start Minikube
With Minikube and kubectl installed, you can now start Minikube using VirtualBox as the driver:
minikube start --driver=virtualbox
If you're using KVM, run:
minikube start --driver=kvm2
This command will start Minikube and configure a local Kubernetes cluster. You can check the status of the cluster with:
minikube status
Step 5: Interact with Kubernetes
Now that your Minikube cluster is running, you can interact with it using kubectl
. For example, to view the nodes in your cluster, run:
kubectl get nodes
You should see the Minikube node listed as "Ready."
Step 6: Deploy an Application on Minikube
To test your Kubernetes cluster, deploy a sample application. For example, deploy an NGINX server with the following command:
kubectl create deployment nginx --image=nginx
Expose the NGINX deployment to make it accessible from outside the cluster:
kubectl expose deployment nginx --type=NodePort --port=80
Find the IP address of the Minikube cluster and the port number:
minikube service nginx --url
Visit the displayed URL in your browser to see the running NGINX application.
Step 7: Stop Minikube
When you're done, you can stop the Minikube cluster with:
minikube stop
To delete the cluster entirely, run:
minikube delete
Benefits of Hosting Kubernetes on a VPS
Hosting Kubernetes clusters on a Windows VPS or a virtual private server hosting Windows allows you to build, test, and deploy containerized applications in a scalable environment. Whether you're using a UK Windows VPS or Windows VPS Italy, Minikube provides an excellent tool for local Kubernetes development and testing.
For more robust deployments, consider using Windows Virtual Dedicated Server Hosting to scale up your Kubernetes infrastructure, ensuring higher availability and more control over resource allocation.
Conclusion
Minikube is a great tool for developers looking to experiment with Kubernetes on their local machines or on a VPS. By following this guide, you can install and configure Minikube on Ubuntu 20.04 and start building Kubernetes-based applications. For more robust solutions, consider Windows VPS Hosting UK for running production Kubernetes clusters with dedicated resources and scalable infrastructure.