Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a way to create a multi-minions cluster on local VMs faster than with vagrant. #4498

Merged
merged 1 commit into from
Feb 26, 2015

Conversation

lhuard1A
Copy link

libvirt-coreos

libvirt-coreos is a cluster provider for kubernetes that starts local VMs and runs kubernetes on it.
Its goal is to provide a multi-machines environment to develop and test kubernetes.

The purpose is mostly the same as the vagrant provider but with a big focus on efficiency. Indeed, the vagrant cluster takes a long time to boot and consumes a huge amount of disk space.

The following array summarizes the differences between the vagrant and the libvirt-coreos kubernetes provider for a cluster with 1 master and 3 minions:

Resource vagrant libvirt-coreos difference
Time to boot¹ 19 min 8 s ~140 times faster
Disk space² 9 Gb 950 Mb ~9.5 times less disk space
Memory footprint³ 2.4 Gb 650 Mb ~3.7 times less memory

The first time the cluster (either vagrant or libvirt-coreos) is started, a base image (named “box” in vagrant language) for the VMs is downloaded. This image don’t need to be downloaded again for the subsequent boot.

The above figures were measured for the second or following boot. The time doesn’t take into account the download of the base image.

export NUM_MINIONS=3
export KUBERNETES_PROVIDER=…
cluster/kube-up.sh # May download the VM base image
cluster/kube-down.sh
# Note the disk and memory usage of the host.
time cluster/kube-up.sh
# Note the disk and memory usage of the host.
cluster/kube-down.sh

¹ The time to boot is the elapsed time measured by time cluster/kube-up.sh.

² The disk space is measured with df /home before and after cluster/kube-up.sh

³ The memory usage is measured with free before and after cluster/kube-up.sh

As the libvirt-coreos cluster provider is cheaper than the vagrant one, it allows to start bigger clusters.

How to it works

It uses libvirt and qemu-kvm as hypervisor (in order to benefit from disk copy-on-write and linux Kernel Samepage Merging feature).

As OS, it uses CoreOS because it has the advantages of:

  • being light;
  • coming with docker and etcd already functional;
  • being configurable with a cloud-init file.

Reduced disk space

Vagrant copies the base image to create the disk for VMs whereas libvirt-coreos uses the Copy-on-Write feature of QEMU to create cheap VM drive.

Vagrant installs stuff inside each VM whereas in libvirt-coreos, all the VMs mount a drive from the host which contains the kubernetes binaries.

All in all, vagrant creates a 2.4 Gib file per VM whereas libvirt-coreos creates a 120 Mib file per VM.

Reduced memory footprint

libvirt-coreos uses qemu-kvm as hypervisor. qemu-kvm can use KSM to deduplicate memory pages.

Reduced boot time

Vagrant needs to:

  1. start the VM;
  2. Wait for sshd to be started;
  3. Connect via sshd to the VM to provision it;
  4. Vagrant finishes the setup of one VM before starting with the next VM.

libvirt-coreos uses cloud-config to let the VM provision themselves as soon as possible. libvirt-coreos’s kube-up starts all the VM and let them being provisioned in parallel.

@googlebot
Copy link

Thanks for your pull request.

It looks like this may be your first contribution to a Google open source project, in which case you'll need to sign a Contributor License Agreement (CLA) at https://cla.developers.google.com/.

If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check the information on your CLA or see this help article on setting the email on your git commits.

Once you've done that, please reply here to let us know. If you signed the CLA as a corporation, please let us know the company's name.

@googlebot
Copy link

CLAs look good, thanks!

@nikhiljindal
Copy link
Contributor

/cc @brendandburns @thockin to find an appropriate reviewer

@erictune
Copy link
Member

Consider adding a line-item to
https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/getting-started-guides/README.md

On Tue, Feb 17, 2015 at 1:46 PM, Nikhil Jindal notifications@github.com
wrote:

/cc @brendandburns https://github.com/brendandburns @thockin
https://github.com/thockin to find an appropriate reviewer


Reply to this email directly or view it on GitHub
#4498 (comment)
.

libvirt-coreos is a cluster provider for kubernetes that starts local VMs and
runs kubernetes on it.
Its goal is to provide a multi-machines environment to develop and test kubernetes.

The purpose is mostly the same as the vagrant provider but with a big focus on
efficiency. The vagrant cluster takes a long time to boot and consumes a huge
amount of disk space. libvirt-coreos aims at being cheaper. As a consequence,
libvirt-coreos allows to start bigger clusters with more minions than vagrant.
@lhuard1A
Copy link
Author

@erictune : Thanks for the tip. docs/getting-started-guides/README.md updated.

@erictune
Copy link
Member

Thanks, that part looks good.

On Thu, Feb 19, 2015 at 3:49 AM, Lénaïc Huard notifications@github.com
wrote:

@erictune https://github.com/erictune : Thanks for the tip.
docs/getting-started-guides/README.md
https://github.com/lhuard1A/kubernetes/blob/libvirt-coreos/docs/getting-started-guides/README.md
updated.


Reply to this email directly or view it on GitHub
#4498 (comment)
.

@brendandburns
Copy link
Contributor

LGTM. Merging.

brendandburns added a commit that referenced this pull request Feb 26, 2015
Provide a way to create a multi-minions cluster on local VMs faster than with vagrant.
@brendandburns brendandburns merged commit dca8863 into kubernetes:master Feb 26, 2015
@brendandburns
Copy link
Contributor

Thanks for the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants