Salt Virt for Linux Containers and Virtualization Management
Matthew Williams
matthew@flowroute.com
• Enterprise Class VoIP Provider!
• Manage about 100 minions… and growing!
• Adopted Salt in 2013
Salt and Virtualization
• Two Unique Systems!
• virt: Virtualization via libvirt (e.g., KVM, VMware)!
• lxc: Linux Contain...
virt
virt
• virt execution module!
• create, destroy, start, stop VMs!
• obtain information about VMs!
• virt runner!
• orchest...
Preparing the Host
• Host system with libvirt and python-libvirt installed!
• Network bridge configured (On Ubuntu libvirt...
Preparing an Image
• A base VM image is needed.!
• May be built with vmbuilder:
vmbuilder kvm ubuntu --suite precise --fla...
Creating VMs
salt-run virt.init test 1 256 salt://test_img.qcow nic=default
• selects the least loaded hyper (based on mem...
Managing VMs
salt-run virt.pause test!
salt-run virt.resume test
• pause and resume
• power off and restart
salt-run virt....
Managing VMs
salt-run virt.purge test
• delete forever
Documentation
http:/docs.saltstack.com/topics/tutorials/cloud_controller.html!
!
http://docs.saltstack.com/ref/runners/all...
lxc: Linux Containers
lxc
• lxc execution module!
• create, destroy, start, stop containers!
• obtain information about containers!
• lxc runner...
Linux Containers
• Kernel containment features are utilized, including:!
• Namespaces (ipc, uts, mount, pid, network and u...
Preparing the Host
• Install the lxc package and ensure the service is running
lxc:!
pkg:!
- installed!
service:!
- runnin...
Preparing the Host
• configure lxc.nic and lxc.profile in
pillar (or minion config)
lxc.nic:!
default:!
eth0:!
link: lxcbr...
The LXC Runner
salt-run lxc.init name host=minion_id [cpuset=cgroups_cpuset] 
[cpushare=cgroups_cpushare] [memory=cgroups_...
Creating a Container
salt-run lxc.init test host=host_minion !
profile=ubuntu memory=256
• Utilizes the ubuntu lxc templat...
Managing Containers
salt-run lxc.freeze test!
salt-run lxc.unfreeze test
• freeze and unfreeze
• power off and restart
sal...
Managing Containers
salt-run lxc.purge test
• delete forever
Documentation
http://docs.saltstack.com/ref/runners/all/salt.runners.lxc.html!
!
http://docs.saltstack.com/ref/modules/all...
We’re Hiring
flowroute.com/jobs
Questions?
irc:mgw
matthew@flowroute.com
www.github.com/mgwilliams
SaltConf14 - Matthew Williams, Flowroute - Salt Virt for Linux contatiners and virtualization management
Upcoming SlideShare
Loading in …5
×

SaltConf14 - Matthew Williams, Flowroute - Salt Virt for Linux contatiners and virtualization management

1,871 views

Published on

This SaltConf14 talk by Matthew Williams of Flowroute shows the power of Salt Virt and Runner for creating and managing VMs and Linux containers. A demonstration of the Salt lxc module shows the simplicity with which containers and VMs can be created and configured.

Published in: Software, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,871
On SlideShare
0
From Embeds
0
Number of Embeds
14
Actions
Shares
0
Downloads
20
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

SaltConf14 - Matthew Williams, Flowroute - Salt Virt for Linux contatiners and virtualization management

  1. 1. Salt Virt for Linux Containers and Virtualization Management
  2. 2. Matthew Williams matthew@flowroute.com
  3. 3. • Enterprise Class VoIP Provider! • Manage about 100 minions… and growing! • Adopted Salt in 2013
  4. 4. Salt and Virtualization • Two Unique Systems! • virt: Virtualization via libvirt (e.g., KVM, VMware)! • lxc: Linux Containers
  5. 5. virt
  6. 6. virt • virt execution module! • create, destroy, start, stop VMs! • obtain information about VMs! • virt runner! • orchestrate deployment of VMs! • pre-accept minion keys for VMs
  7. 7. Preparing the Host • Host system with libvirt and python-libvirt installed! • Network bridge configured (On Ubuntu libvirt-bin
 package does this for you)! • default nic profile in pillar 
 or minion config: virt.nic:! default:! eth0:! bridge: virbr0! model: virtio
  8. 8. Preparing an Image • A base VM image is needed.! • May be built with vmbuilder: vmbuilder kvm ubuntu --suite precise --flavour virtual - ! --dest test_img --ppa saltstack --addpkg salt-minion • Preinstall salt-minion if possible! • Most cloud-ready images will also work
  9. 9. Creating VMs salt-run virt.init test 1 256 salt://test_img.qcow nic=default • selects the least loaded hyper (based on memory)! • caches and clones the image! • installs salt-minion (if needed)! • configures the minion and pre signs its key! • starts the VM
  10. 10. Managing VMs salt-run virt.pause test! salt-run virt.resume test • pause and resume • power off and restart salt-run virt.force_off test! salt-run virt.start test salt-run virt.reset test
  11. 11. Managing VMs salt-run virt.purge test • delete forever
  12. 12. Documentation http:/docs.saltstack.com/topics/tutorials/cloud_controller.html! ! http://docs.saltstack.com/ref/runners/all/salt.runners.virt.html
  13. 13. lxc: Linux Containers
  14. 14. lxc • lxc execution module! • create, destroy, start, stop containers! • obtain information about containers! • lxc runner (develop branch only)! • orchestrate deployment of containers! • pre-accept minion keys for containers
  15. 15. Linux Containers • Kernel containment features are utilized, including:! • Namespaces (ipc, uts, mount, pid, network and user)! • Chroots! • cgroups! • More like a virtual environment than a virtual machine More Info: www.linuxcontainers.org
  16. 16. Preparing the Host • Install the lxc package and ensure the service is running lxc:! pkg:! - installed! service:! - running! - require:! - pkg: lxc
  17. 17. Preparing the Host • configure lxc.nic and lxc.profile in pillar (or minion config) lxc.nic:! default:! eth0:! link: lxcbr0! type: veth! ! lxc.profile:! ubuntu:! template: ubuntu! backing: lvm! vgname: lxc! size: 1G
  18. 18. The LXC Runner salt-run lxc.init name host=minion_id [cpuset=cgroups_cpuset] [cpushare=cgroups_cpushare] [memory=cgroups_memory] [nic=nic_profile] [profile=lxc_profile] [nic_opts=nic_opts] [start=(true|false)] [seed=(true|false)] [install=(true|false)] [config=minion_config]
  19. 19. Creating a Container salt-run lxc.init test host=host_minion ! profile=ubuntu memory=256 • Utilizes the ubuntu lxc template (many are available)! - Pulls an ubuntu image, if needed, and caches it! • Installs salt-minion and pre-seeds config and keys! • Starts the container
  20. 20. Managing Containers salt-run lxc.freeze test! salt-run lxc.unfreeze test • freeze and unfreeze • power off and restart salt-run lxc.stop test! salt-run lxc.start test
  21. 21. Managing Containers salt-run lxc.purge test • delete forever
  22. 22. Documentation http://docs.saltstack.com/ref/runners/all/salt.runners.lxc.html! ! http://docs.saltstack.com/ref/modules/all/salt.modules.lxc.html
  23. 23. We’re Hiring flowroute.com/jobs
  24. 24. Questions? irc:mgw matthew@flowroute.com www.github.com/mgwilliams

×