Merge pull request #248 from jimmidyson/xhyve

Add xhyve driver support
pull/271/head
dlorenc 2016-07-04 08:10:16 -07:00 committed by GitHub
commit 5076ef407a
8 changed files with 80 additions and 17 deletions

31
DRIVERS.md Normal file
View File

@ -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
```

View File

@ -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

View File

@ -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

View File

@ -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)
}

View File

@ -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,
}
}

View File

@ -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")
}

View File

@ -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)
}
}

View File

@ -51,6 +51,7 @@ var SupportedVMDrivers = [...]string{
"virtualbox",
"vmwarefusion",
"kvm",
"xhyve",
}
const (