diff --git a/DRIVERS.md b/DRIVERS.md new file mode 100644 index 0000000000..170031d258 --- /dev/null +++ b/DRIVERS.md @@ -0,0 +1,31 @@ +# 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: + +* [KVM](#kvm-driver) +* [xhyve](#xhyve-driver) + +#### KVM driver + +Download the `docker-machine-driver-kvm` binary from +https://github.com/dhiltgen/docker-machine-kvm/releases and put it somewhere in +your PATH. Minikube is currently tested against `docker-machine-driver-kvm` 0.7.0. + +#### xhyve driver + +From https://github.com/zchee/docker-machine-driver-xhyve#install: + +``` +$ brew install docker-machine-driver-xhyve + +# 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 +``` diff --git a/README.md b/README.md index 9bc12ce776..d4efa72b78 100644 --- a/README.md +++ b/README.md @@ -19,8 +19,10 @@ Minikube is a tool that makes it easy to run Kubernetes locally. Minikube runs a ### Requirements -* [VirtualBox](https://www.virtualbox.org/wiki/Downloads), [VMware Fusion](https://www.vmware.com/products/fusion) -or [KVM](http://www.linux-kvm.org/) installation +* OS X + * [xhyve driver](DRIVERS.md#xhyve-driver), [VirtualBox](https://www.virtualbox.org/wiki/Downloads) or [VMware Fusion](https://www.vmware.com/products/fusion) installation +* Linux + * [VirtualBox](https://www.virtualbox.org/wiki/Downloads) or [KVM](http://www.linux-kvm.org/) installation, * VT-x/AMD-v virtualization must be enabled in BIOS ### Instructions @@ -35,7 +37,8 @@ the following drivers: * virtualbox * vmwarefusion -* kvm ([driver installation](#kvm-driver)) +* kvm ([driver installation](DRIVERS.md#kvm-driver)) +* xhyve ([driver installation](DRIVERS.md#xhyve-driver)) Note that the IP below is dynamic and can change. It can be retrieved with `minikube ip`. @@ -70,19 +73,10 @@ Stopping local Kubernetes cluster... Stopping "minikubeVM"... ``` -### Driver plugin installation +### Driver plugins -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. - -#### KVM driver - -Download the `docker-machine-driver-kvm` binary from -https://github.com/dhiltgen/docker-machine-kvm/releases and put it somewhere in -your PATH. Minikube is currently tested against `docker-machine-driver-kvm` 0.7.0. +See [DRIVERS](DRIVERS.md) for details on supported drivers and how to install +plugins, if required. ### Reusing the Docker daemon diff --git a/docs/minikube_start.md b/docs/minikube_start.md index 61a2254b6f..965e49a4a6 100644 --- a/docs/minikube_start.md +++ b/docs/minikube_start.md @@ -18,7 +18,7 @@ minikube start --cpus=1: Number of CPUs allocated to the minikube VM --iso-url="https://storage.googleapis.com/minikube/minikube-0.4.iso": Location of the minikube iso --memory=1024: Amount of RAM allocated to the minikube VM - --vm-driver="virtualbox": VM driver is one of: [virtualbox vmwarefusion kvm] + --vm-driver="virtualbox": VM driver is one of: [virtualbox vmwarefusion kvm xhyve] ``` ### Options inherited from parent commands diff --git a/pkg/minikube/cluster/cluster.go b/pkg/minikube/cluster/cluster.go index 389099b1bb..88a8ebe293 100644 --- a/pkg/minikube/cluster/cluster.go +++ b/pkg/minikube/cluster/cluster.go @@ -281,6 +281,8 @@ func createHost(api libmachine.API, config MachineConfig) (*host.Host, error) { driver = createVMwareFusionHost(config) case "kvm": driver = createKVMHost(config) + case "xhyve": + driver = createXhyveHost(config) default: glog.Exitf("Unsupported driver: %s\n", config.VMDriver) } diff --git a/pkg/minikube/cluster/cluster_darwin.go b/pkg/minikube/cluster/cluster_darwin.go index 50506ca5ab..4bde535f0e 100644 --- a/pkg/minikube/cluster/cluster_darwin.go +++ b/pkg/minikube/cluster/cluster_darwin.go @@ -33,3 +33,34 @@ func createVMwareFusionHost(config MachineConfig) drivers.Driver { d.ISO = d.ResolveStorePath("boot2docker.iso") return d } + +type xhyveDriver struct { + *drivers.BaseDriver + Boot2DockerURL string + BootCmd string + CPU int + CaCertPath string + DiskSize int64 + MacAddr string + Memory int + PrivateKeyPath string + UUID string + NFSShare bool + DiskNumber int + Virtio9p bool + Virtio9pFolder string +} + +func createXhyveHost(config MachineConfig) *xhyveDriver { + return &xhyveDriver{ + BaseDriver: &drivers.BaseDriver{ + MachineName: constants.MachineName, + StorePath: constants.Minipath, + }, + Memory: config.Memory, + CPU: config.CPUs, + Boot2DockerURL: config.MinikubeISO, + BootCmd: "loglevel=3 user=docker console=ttyS0 console=tty0 noembed nomodeset norestore waitusb=10 base host=boot2docker", + DiskSize: 20000, + } +} diff --git a/pkg/minikube/cluster/cluster_non_darwin_panic.go b/pkg/minikube/cluster/cluster_non_darwin_panic.go index 50923f7798..c67bde37e1 100644 --- a/pkg/minikube/cluster/cluster_non_darwin_panic.go +++ b/pkg/minikube/cluster/cluster_non_darwin_panic.go @@ -23,3 +23,7 @@ import "github.com/docker/machine/libmachine/drivers" func createVMwareFusionHost(config MachineConfig) drivers.Driver { panic("vmwarefusion not supported") } + +func createXhyveHost(config MachineConfig) drivers.Driver { + panic("xhyve not supported") +} diff --git a/pkg/minikube/cluster/cluster_test.go b/pkg/minikube/cluster/cluster_test.go index dc05b992b9..d8d3b4477d 100644 --- a/pkg/minikube/cluster/cluster_test.go +++ b/pkg/minikube/cluster/cluster_test.go @@ -69,7 +69,7 @@ func TestCreateHost(t *testing.T) { } if !found { - t.Fatalf("Wrong driver name: %v. Should be virtualbox, vmwarefusion or kvm.", h.DriverName) + t.Fatalf("Wrong driver name: %v. Should be virtualbox, vmwarefusion, kvm or xhyve.", h.DriverName) } } diff --git a/pkg/minikube/constants/constants.go b/pkg/minikube/constants/constants.go index a5fc516ee3..f83ef91d75 100644 --- a/pkg/minikube/constants/constants.go +++ b/pkg/minikube/constants/constants.go @@ -51,6 +51,7 @@ var SupportedVMDrivers = [...]string{ "virtualbox", "vmwarefusion", "kvm", + "xhyve", } const (