Sergey Nivens - Fotolia
The main purpose of Kubernetes is to host applications across a cluster of servers with sophisticated load balancing and resource allocation features. This ensures applications run smoothly, even if some servers fail. In production deployments, the use of multiple servers for Kubernetes is essential.
However, there are situations where an IT admin or developer might want to run Kubernetes locally on a PC or laptop. A local Kubernetes environment, for example, enables developers to test new application code quickly without having to upload it to a production cluster first. Local Kubernetes is also a great way for newcomers to play around with the container orchestration system without the complexity and cost of a full-scale, multiserver deployment.
Below are three approaches to run Kubernetes locally, all of which will work on a PC or laptop with Windows, Linux or macOS.
Minikube is a version of Kubernetes designed specifically for local deployments. Developed by the Kubernetes open source community, Minikube uses a VM to create a single-node local Kubernetes installation.
Minikube installation is fairly straightforward, as Windows, Linux and macOS installers automate most of the process, including VM setup. First, however, be sure to have a VM platform, such as Hyper-V, VirtualBox or KVM, installed.
Once Minkube is set up, use kubectl, the standard Kubernetes command-line tool, to interact with the cluster.
The major limitation of Minikube is that the local cluster can consist of only one node, and therefore is not a great simulation of a production-level, multinode Kubernetes cluster.
MicroK8s is a Kubernetes distribution from Canonical that is designed for fast and simple deployment, which makes it a good choice to run Kubernetes locally.
MicroK8s installation is simple on any Linux distribution that supports snap packages -- an application packaging framework that Canonical created for use primarily on Ubuntu, the company's Linux distribution. Installing MicroK8s on Windows and macOS is also straightforward, as the MicroK8s installers for these systems create Ubuntu-based VMs, and then use snap packages to install MicroK8s on them.
Unlike Minikube, IT admins or developers can use MicroK8s to create multi-node clusters. If MicroK8s runs on Linux, it also offers the advantage of not requiring VMs. On Windows and macOS, MicroK8s uses a VM framework called Multipass to create VMs for the Kubernetes cluster.
Perhaps the biggest drawback of MicroK8s is that it is difficult to install on Linux distributions that don't support snap packages.
K3s is a lightweight Kubernetes variant from Rancher. It's designed to be a production-level Kubernetes environment, intended primarily for deployment on hardware devices with low resource profiles, such as IoT sensors.
However, K3s can also run locally for Kubernetes testing or development. To do this, first create at least two VMs on a local system using a platform such as VMware, VirtualBox or KVM. K3s doesn't create the VMs for you, so you'll need to do this manually.
Then, install the K3s server on one VM, and the K3s agent on the other. This creates a miniature Kubernetes cluster on a local device.
K3s requires more manual work to set up and provision than MicroK8s and Minikube. However, because K3s is designed for full-scale production use, it offers the closest option to a production-level server on a PC or laptop.
Dig Deeper on Managing Virtual Containers
Related Q&A from Chris Tozzi
Review the similarities and differences between CloudFront and Cloudflare to help your IT team choose between these two popular CDN services. Continue Reading
Pods and deployments are both important to using Kubernetes in production, but they're not the same. Learn the role each one plays in building and ... Continue Reading
Red Hat OpenShift and Kubernetes share a lot of similarities -- including the same underlying container orchestration technology. So how are they ... Continue Reading