minikube/docs/drivers.md

162 lines
7.0 KiB
Markdown
Raw Normal View History

2016-06-30 21:06:27 +00:00
# Driver plugin installation
Minikube uses Docker Machine to manage the Kubernetes VM so it benefits from the
driver plugin architecture that Docker Machine uses to provide a consistent way to
manage various VM providers. Minikube embeds VirtualBox and VMware Fusion drivers
so there are no additional steps to use them. However, other drivers require an
extra binary to be present in the host PATH.
The following drivers currently require driver plugin binaries to be present in
the host PATH:
2017-11-29 20:20:29 +00:00
* [KVM2](#kvm2-driver)
2016-06-30 21:06:27 +00:00
* [KVM](#kvm-driver)
* [Hyperkit](#hyperkit-driver)
2016-06-30 21:06:27 +00:00
* [xhyve](#xhyve-driver)
* [HyperV](#hyperv-driver)
* [VMware](#vmware-unified-driver)
2016-06-30 21:06:27 +00:00
2017-11-29 20:20:29 +00:00
#### KVM2 driver
The KVM2 driver is intended to replace KVM driver.
The KVM2 driver is maintained by the minikube team, and is built, tested and released with minikube.
NOTE: Currently the following instruction doesn't work for
Ubuntu prior to 18.04 because the docker-machine-driver-kvm2 binary
provided by the URL needs libvirt 3.0.0 or later.
You can workaround it by building the binary by yourself.
2017-11-29 20:20:29 +00:00
To install the KVM2 driver, first install and configure the prereqs:
2018-02-12 11:42:03 +00:00
```shell
2017-11-29 20:20:29 +00:00
# Install libvirt and qemu-kvm on your system, e.g.
# Debian/Ubuntu (for older Debian/Ubuntu versions, you may have to use libvirt-bin instead of libvirt-clients and libvirt-daemon-system)
sudo apt install libvirt-clients libvirt-daemon-system qemu-kvm
2017-11-29 20:20:29 +00:00
# Fedora/CentOS/RHEL
sudo yum install libvirt-daemon-kvm qemu-kvm
2017-11-29 20:20:29 +00:00
# Add yourself to the libvirt group so you don't need to sudo
# NOTE: For older Debian/Ubuntu versions change the group to `libvirtd`
sudo usermod -a -G libvirt $(whoami)
2017-11-29 20:20:29 +00:00
# Update your current session for the group change to take effect
# NOTE: For older Debian/Ubuntu versions change the group to `libvirtd`
newgrp libvirt
2017-11-29 20:20:29 +00:00
```
Then install the driver itself:
2018-02-12 11:42:03 +00:00
```shell
curl -LO https://storage.googleapis.com/minikube/releases/latest/docker-machine-driver-kvm2 \
2018-10-03 01:22:50 +00:00
&& sudo install docker-machine-driver-kvm2 /usr/local/bin/
2017-11-29 20:20:29 +00:00
```
To use the driver you would do:
2018-02-12 11:42:03 +00:00
```shell
minikube start --vm-driver kvm2
```
2016-06-30 21:06:27 +00:00
#### KVM driver
2017-05-01 18:17:24 +00:00
Minikube is currently tested against [`docker-machine-driver-kvm` v0.10.0](https://github.com/dhiltgen/docker-machine-kvm/releases).
2017-05-01 18:17:24 +00:00
After following the instructions on the KVM driver releases page, you need to make sure that have the necessary packages and permissions by following these instructions:
2018-02-12 11:42:03 +00:00
```shell
# Install libvirt and qemu-kvm on your system, e.g.
# Debian/Ubuntu (for older Debian/Ubuntu versions, you may have to use libvirt-bin instead of libvirt-clients and libvirt-daemon-system)
sudo apt install libvirt-clients libvirt-daemon-system qemu-kvm
# Fedora/CentOS/RHEL
sudo yum install libvirt-daemon-kvm qemu-kvm
# Add yourself to the libvirt group so you don't need to sudo
# NOTE: For older Debian/Ubuntu versions change the group to `libvirtd`
sudo usermod -a -G libvirt $(whoami)
# Update your current session for the group change to take effect
# NOTE: For older Debian/Ubuntu versions change the group to `libvirtd`
newgrp libvirt
```
2016-06-30 21:06:27 +00:00
To use the driver you would do:
2018-02-12 11:42:03 +00:00
```shell
minikube start --vm-driver kvm
```
#### Hyperkit driver
The Hyperkit driver will eventually replace the existing xhyve driver.
It is built from the minikube source tree, and uses [moby/hyperkit](http://github.com/moby/hyperkit) as a Go library.
To install the hyperkit driver via brew:
```shell
brew install docker-machine-driver-hyperkit
# docker-machine-driver-hyperkit need root owner and uid
sudo chown root:wheel /usr/local/opt/docker-machine-driver-hyperkit/bin/docker-machine-driver-hyperkit
sudo chmod u+s /usr/local/opt/docker-machine-driver-hyperkit/bin/docker-machine-driver-hyperkit
```
To install the hyperkit driver manually:
2018-02-12 11:42:03 +00:00
```shell
curl -LO https://storage.googleapis.com/minikube/releases/latest/docker-machine-driver-hyperkit \
&& sudo install -o root -g wheel -m 4755 docker-machine-driver-hyperkit /usr/local/bin/
```
The hyperkit driver currently requires running as root to use the vmnet framework to setup networking.
2017-12-11 04:39:35 +00:00
If you encountered errors like `Could not find hyperkit executable`, you might need to install [Docker for Mac](https://store.docker.com/editions/community/docker-ce-desktop-mac)
If you are using [dnsmasq](http://www.thekelleys.org.uk/dnsmasq/doc.html) in your setup and cluster creation fails (stuck at kube-dns initialization) you might need to add `listen-address=192.168.64.1` to `dnsmasq.conf`.
*Note: If `dnsmasq.conf` contains `listen-address=127.0.0.1` kubernetes discovers dns at 127.0.0.1:53 and tries to use it using bridge ip address, but dnsmasq replies only to requests from 127.0.0.1*
2016-06-30 21:06:27 +00:00
#### xhyve driver
From https://github.com/zchee/docker-machine-driver-xhyve#install:
2018-02-12 11:42:03 +00:00
```shell
brew install docker-machine-driver-xhyve
2016-06-30 21:06:27 +00:00
# docker-machine-driver-xhyve need root owner and uid
sudo chown root:wheel $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
sudo chmod u+s $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
2016-06-30 21:06:27 +00:00
```
#### HyperV driver
Hyper-v users may need to create a new external network switch as described [here](https://docs.docker.com/machine/drivers/hyper-v/). This step may prevent a problem in which `minikube start` hangs indefinitely, unable to ssh into the minikube virtual machine. In this add, add the `--hyperv-virtual-switch=switch-name` argument to the `minikube start` command.
2018-06-19 21:05:29 +00:00
On some machines, having **dynamic memory management** turned on for the minikube VM can cause problems of unexpected and random restarts which manifests itself in simply losing the connection to the cluster, after which `minikube status` would simply state `stopped`. Machine restarts are caused due to following Hyper-V error: `The dynamic memory balancer could not add memory to the virtual machine 'minikube' because its configured maximum has been reached`. **Solution**: turned the dynamic memory management in hyper-v settings off (and allocate a fixed amount of memory to the machine).
#### VMware unified driver
The VMware unified driver will eventually replace the existing vmwarefusion driver.
The new unified driver supports both VMware Fusion (on macOS) and VMware Workstation (on Linux and Windows)
To install the vmware unified driver, head over at https://github.com/machine-drivers/docker-machine-driver-vmware/releases and download the release for your operating system.
The driver must be:
1. Stored in `$PATH`
2. Named `docker-machine-driver-vmware`
3. Executable (`chmod +x` on UNIX based platforms)
If you're running on macOS with Fusion, this is an easy way install the driver:
```shell
export LATEST_VERSION=$(curl -L -s -H 'Accept: application/json' https://github.com/machine-drivers/docker-machine-driver-vmware/releases/latest | sed -e 's/.*"tag_name":"\([^"]*\)".*/\1/') \
&& curl -L -o docker-machine-driver-vmware https://github.com/machine-drivers/docker-machine-driver-vmware/releases/download/$LATEST_VERSION/docker-machine-driver-vmware_darwin_amd64 \
&& chmod +x docker-machine-driver-vmware \
&& mv docker-machine-driver-vmware /usr/local/bin/
```
To use the driver you would do:
```shell
minikube start --vm-driver vmware
```