Add kvm driver support
parent
639ca1e130
commit
a738a0f5ad
24
README.md
24
README.md
|
@ -19,7 +19,8 @@ Minikube is a tool that makes it easy to run Kubernetes locally. Minikube runs a
|
|||
|
||||
### Requirements
|
||||
|
||||
* [VirtualBox](https://www.virtualbox.org/wiki/Downloads) or [VMware Fusion](https://www.vmware.com/products/fusion) installation
|
||||
* [VirtualBox](https://www.virtualbox.org/wiki/Downloads), [VMware Fusion](https://www.vmware.com/products/fusion)
|
||||
or [KVM](http://www.linux-kvm.org/) installation
|
||||
* VT-x/AMD-v virtualization must be enabled in BIOS
|
||||
|
||||
### Instructions
|
||||
|
@ -29,7 +30,12 @@ See the installation instructions for the [latest release](https://github.com/ku
|
|||
## Quickstart
|
||||
|
||||
Here's a brief demo of minikube usage.
|
||||
If you want to change the VM driver to VMware Fusion add the `--vm-driver=vmwarefusion` flag to `minikube start`.
|
||||
If you want to change the VM driver add the appropriate `--vm-driver=xxx` flag to `minikube start`. Minikube Supports
|
||||
the following drivers:
|
||||
|
||||
* virtualbox
|
||||
* vmwarefusion
|
||||
* kvm ([driver installation](#kvm-driver))
|
||||
|
||||
Note that the IP below is dynamic and can change. It can be retrieved with `minikube ip`.
|
||||
|
||||
|
@ -64,6 +70,20 @@ Stopping local Kubernetes cluster...
|
|||
Stopping "minikubeVM"...
|
||||
```
|
||||
|
||||
### 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.
|
||||
|
||||
#### 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.
|
||||
|
||||
### Reusing the Docker daemon
|
||||
|
||||
When using a single VM of kubernetes its really handy to reuse the Docker daemon inside the VM; as this means you don't have to build on your host machine and push the image into a docker registry - you can just build inside the same docker daemon as minikube which speeds up local experiments.
|
||||
|
|
|
@ -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]
|
||||
--vm-driver="virtualbox": VM driver is one of: [virtualbox vmwarefusion kvm]
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
|
|
@ -268,7 +268,7 @@ func SetupCerts(d drivers.Driver) error {
|
|||
}
|
||||
|
||||
func createHost(api libmachine.API, config MachineConfig) (*host.Host, error) {
|
||||
var driver drivers.Driver
|
||||
var driver interface{}
|
||||
|
||||
switch config.VMDriver {
|
||||
case "virtualbox":
|
||||
|
@ -279,6 +279,8 @@ func createHost(api libmachine.API, config MachineConfig) (*host.Host, error) {
|
|||
driver = d
|
||||
case "vmwarefusion":
|
||||
driver = createVMwareFusionHost(config)
|
||||
case "kvm":
|
||||
driver = createKVMHost(config)
|
||||
default:
|
||||
glog.Exitf("Unsupported driver: %s\n", config.VMDriver)
|
||||
}
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package cluster
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/docker/machine/libmachine/drivers"
|
||||
"k8s.io/minikube/pkg/minikube/constants"
|
||||
)
|
||||
|
||||
type kvmDriver struct {
|
||||
*drivers.BaseDriver
|
||||
|
||||
Memory int
|
||||
DiskSize int
|
||||
CPU int
|
||||
Network string
|
||||
PrivateNetwork string
|
||||
ISO string
|
||||
Boot2DockerURL string
|
||||
DiskPath string
|
||||
CacheMode string
|
||||
IOMode string
|
||||
}
|
||||
|
||||
func createKVMHost(config MachineConfig) *kvmDriver {
|
||||
return &kvmDriver{
|
||||
BaseDriver: &drivers.BaseDriver{
|
||||
MachineName: constants.MachineName,
|
||||
StorePath: constants.Minipath,
|
||||
},
|
||||
Memory: config.Memory,
|
||||
CPU: config.CPUs,
|
||||
Network: "default",
|
||||
PrivateNetwork: "docker-machines",
|
||||
Boot2DockerURL: config.MinikubeISO,
|
||||
DiskSize: 20000,
|
||||
DiskPath: filepath.Join(constants.Minipath, "machines", constants.MachineName, fmt.Sprintf("%s.img", constants.MachineName)),
|
||||
ISO: filepath.Join(constants.Minipath, "machines", constants.MachineName, "boot2docker.iso"),
|
||||
CacheMode: "default",
|
||||
IOMode: "threads",
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
// +build !linux
|
||||
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package cluster
|
||||
|
||||
import "github.com/docker/machine/libmachine/drivers"
|
||||
|
||||
func createKVMHost(config MachineConfig) drivers.Driver {
|
||||
panic("kvm not supported")
|
||||
}
|
|
@ -69,7 +69,7 @@ func TestCreateHost(t *testing.T) {
|
|||
}
|
||||
|
||||
if !found {
|
||||
t.Fatalf("Wrong driver name: %v. Should be virtualbox or vmwarefusion.", h.DriverName)
|
||||
t.Fatalf("Wrong driver name: %v. Should be virtualbox, vmwarefusion or kvm.", h.DriverName)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ var LogFlags = [...]string{
|
|||
var SupportedVMDrivers = [...]string{
|
||||
"virtualbox",
|
||||
"vmwarefusion",
|
||||
"kvm",
|
||||
}
|
||||
|
||||
const (
|
||||
|
|
Loading…
Reference in New Issue