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 |

Hyper-V was unable to find a virtual machine with name minikube
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 requirements

Minikube 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:

  • At least two CPUs (e.g., a processor with two or more hardware threads). Hardware-assisted virtualization is not required but useful.
  • 2GB of free memory — that is, 2GB of RAM you can spare above and beyond the system’s normal workload requirements.
  • 20 GB of disk space.

You will also need a container or virtual machine manager, something that may vary depending on what platform you’re running:

  • Any platform that supports Docker can use it as the container system. (You can also use the Docker alternative Podman.)
  • Parallels, VirtualBox, VMware Fusion, or VMware Workstation will work as well on any platform that supports them, although these applications come with the additional resource overhead and licensing requirements.
  • On MacOS, HyperKit is supported.
  • On Windows, you can use Hyper-V.

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 Minikube

Depending on which operating system you’re using, you will need to follow different steps to install Minikube.

Linux

The 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/minikube

MacOS

MacOS 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/minikube

Homebrew users can use brew install minikube.

Windows

On 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 Minikube

One 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 driver

Minikube 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 driver

where is one of a number of possible choices. These are the most common (and should be self-explanatory):

  • docker
  • kvm2
  • hyperv

Other drivers are available depending on the platform and one’s installed software:

  • virtualbox – Uses VirtualBox as a VM provider. This is a useful option on Windows if you are unable to use Hyper-V (e.g., if you’re running Windows Home). Note that Minikube will not install VirtualBox; you must set that up yourself.
  • podman – An alternative container runtime to Docker that uses a daemonless architecture and does not require root privileges. Note that this driver is still considered experimental and should not be used in production.
  • vmware – Driver for all VMware-based hypervisors. (Installing the actual VMware software is your responsibility.)
  • hyperkit – Driver for the open source hypervisor for MacOS. This is installed with Docker Desktop, so if you’re already using Docker, you might not need to use this.
  • parallels – Driver for Parallels Desktop for Mac, which does not require VT-x hardware support.
  • ssh – Allows you to run on a user-supplied VM over ssh. Note that when you run minkube start, you must pass the address of the VM with a command-line switch, e.g., --ssh-ip-address=vm.machine.com.
  • none – Use a bare-metal driver, typically on Linux. For advanced or experimental use only.

You can also supply a driver by using a command-line switch whenever you start Minikube:

minikube start --driver=docker

This 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 Minikube

After 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.0

Minikube dashboard

Minikube 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.

Hyper-V was unable to find a virtual machine with name minikube
IDG

The Minikube dashboard provides an all-in-one interactive view for your desktop Kubernetes setup.

Using Minikube instead of Docker Desktop

Because 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:

  1. If you already have Docker Desktop installed, remove it and reboot.
  2. Check that you have the environment variable DOCKER_BUILDKIT set to 1. (This enables BuildKit for better performance during the build process.)
  3. Install the Docker CLI -- not Docker Desktop or the Docker daemon, just the command line tool. One way to do this is with a package manager — e.g., using Chocolatey on Windows.
  4. Launch Minikube normally. If you want to build Docker images, you need to use the Docker driver; if you just want to run containers, you can use a hypervisor or VM.
  5. If you don’t plan to use Kubernetes (just run containers as-is without orchestration features), you can use minikube start --no-kubernetes as the command to start Minikube.
  6. Run minikube docker-env (you may need to do this as admin) to generate a list of instructions needed to configure Docker to use Minikube as its runtime host. These instructions vary by operating system.
  7. After you follow those instructions, the docker command-line tool should use Minikube as its host. You can verify this by typing docker ps and seeing if you get a list of running containers.

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.