Hyper-V was unable to find a virtual machine with name minikube
Learn how to run Kubernetes on the desktop, or as a Docker Desktop replacement, with a stripped-down version of the container orchestration platform for developer use.Senior Writer, InfoWorld | Show
Thinkstock Table of Contents Show More The best way to get your legs with any software application is to jump right in. That’s easier said than done with an application as large, powerful, and complex as Kubernetes, the software that underpins modern container-based application deployments at scale. How can one get a handle on Kubernetes without setting up an entire hardware cluster? You can start small with Minikube. Minikube is an incarnation of Kubernetes, fully API-compatible with its big brother edition, but designed to run on local hardware — a developer’s desktop or notebook. It works cross-platform (Linux, Mac, Windows), supports all of Kubernetes’s container runtimes, and can be extended to add more of Kubernetes's advanced functionality. Please note: This article assumes you already understand the basics of Kubernetes and have worked with it to some degree. If you’re looking for a base tutorial for Kubernetes, you’ll find some good options here. Minikube requirementsMinikube runs on all three major operating systems (although at this point only on x86-64 hardware), and requires a system with internet connectivity and the following specs:
You will also need a container or virtual machine manager, something that may vary depending on what platform you’re running:
If you plan to run Minikube on a system that has no internet access, or only intermittent access, this is possible, but you may need to set up a local container registry from which to pull images. Installing MinikubeDepending on which operating system you’re using, you will need to follow different steps to install Minikube. LinuxThe easiest way to install Minikube on Linux is to install its universal binary, which should work in any common distribution: curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 sudo install minikube-linux-amd64 /usr/local/bin/minikubeMacOSMacOS users can use a highly similar installation method as Linux users: curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-darwin-amd64 sudo install minikube-darwin-amd64 /usr/local/bin/minikubeHomebrew users can use brew install minikube. WindowsOn Windows, one can use the following PowerShell script (as per the Minikube docs) to install Minikube. Be sure to run it as administrator. Note that the directory shown in the script is a temporary installation directory; Minikube does not live in that directory. The second line of the script ensures that the target directory is in the system PATH; you may need to modify the script if you want to change the temporary installation directory. New-Item -Path 'c:\' -Name 'minikube' -ItemType Directory -Force Invoke-WebRequest -OutFile 'c:\minikube\minikube.exe' -Uri 'https://github.com/kubernetes/minikube/releases/latest/download/minikube-windows-amd64.exe' -UseBasicParsing $oldPath = [Environment]::GetEnvironmentVariable('Path', [EnvironmentVariableTarget]::Machine) if ($oldPath.Split(';') -inotcontains 'C:\minikube'){ ` [Environment]::SetEnvironmentVariable('Path', $('{0};C:\minikube' -f $oldPath), [EnvironmentVariableTarget]::Machine) ` }Using virtualization with MinikubeOne doesn’t need to use virtualization to run containers, but it can ease the way. The first step is to make sure that hardware-assisted virtualization is enabled in your machine's BIOS. Sometimes it can be difficult to locate this option. For instance, on some systems, such as those that use a motherboard built primarily for gaming, the option to control hardware virtualization in firmware will be in the section of the BIOS devoted to overclocking options. What’s more, the virtualization option may not be visible by default, but only after you enable visibility for expert-level controls. If you do use virtualization, it is best to use the option in Minikube that is most native to your operating system. On Windows, this would be Hyper-V; on MacOS, HyperKit. On Linux, native containers are ideal, making virtualization entirely optional, although you may have your own reasons for using it (e.g., for enhanced isolation). Setting up a Minikube driverMinikube interacts with your system’s container or hypervisor system via a driver. The available drivers vary by operating system, but you can use Docker as a safe default on all common platforms. To set a driver to use as the default, run the command minikube config set driverwhere
Other drivers are available depending on the platform and one’s installed software:
You can also supply a driver by using a command-line switch whenever you start Minikube: minikube start --driver=dockerThis is useful if you need to temporarily switch drivers to test something. For the most part, though, you’ll want to set a driver to use full-time as part of your standard workflow. Starting MinikubeAfter you have installed Minikube and configured its default driver, you can start the cluster by typing minikube start. The startup process may take a little time, as Minikube may need to fetch images and configure them. You can then use kubectl to work with Minikube just as you would with Kubernetes. Note that rather than type kubectl alone, you may need to prefix it with minikube and use the -- switch to pass parameters along. For instance, instead of kubectl create deployment (plus other options for a deployment), you would type minikube kubectl -- create deployment. Minikube tries to stay up-to-date with the most recent version of Kubernetes. If you need to work with an earlier version, you can do so by specifying a version with the start command: minikube start --kubernetes-version=v1.16.0Minikube dashboardMinikube comes with a web-based dashboard that provides a total view of the cluster: workloads, services, configuration information, cluster data, custom resource definitions, and lots more. To open the dashboard in the default browser, simply type minikube dashboard at the command line. Note that if you close the command session where you’ve launched the dashboard, the dashboard will shut down automatically, unless you launch the dashboard as a detached process. IDGThe Minikube dashboard provides an all-in-one interactive view for your desktop Kubernetes setup. Using Minikube instead of Docker DesktopBecause of the changes in the licensing and costs of Docker Desktop, many developers are exploring alternatives. Minikube can function as a fair replacement for Docker Desktop without too much additional work. Here’s how:
Note that you will need to invoke the commands described by Minkube in step 6 for each command session where you want to use Docker. Serdar Yegulalp is a senior writer at InfoWorld, focused on machine learning, containerization, devops, the Python ecosystem, and periodic reviews. Copyright © 2021 IDG Communications, Inc. |