Top Banner
Copyright © 2013 NTT DATA Corporation DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr) NTT DATA Corporation. CloudOpen Japan 2014
43

DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

Jan 13, 2019

Download

Documents

lambao
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

Copyright © 2013 NTT DATA Corporation

DevOps with Vagrant and KVM/qemu

Hiroshi Miura (@miurahr)NTT DATA Corporation.

CloudOpenJapan 2014

Page 2: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

2Copyright © 2014 NTT DATA Corporation

Disclaimer

Any product name, service name, software name and other marks are trade mark or registered mark of corresponding companies.

This presentation is in a purpose of providing current information on emerging technologies and there is no grantee of correctness and/or persistence of features in any future.

A presenter and NTT Data Corporation provide information in as-is basis and have no responsiveness for results that you got according to information in this presentation material.

Page 3: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

3Copyright © 2014 NTT DATA Corporation

Who am I?

Github.com/nttdata-osscloud

Github.com/miurahr

• Production work

• OpenStack SI team

• Swift object storage

• OSS devel:

• Vagrant-KVM

• Linux Kernel

• etc…

Page 4: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

4Copyright © 2014 NTT DATA Corporation

Agenda

1. What is DevOps

2. Introduction to Vagrant

3. Vagrant-KVM

4. Infrastructure chages

5. Future

Page 5: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

5Copyright © 2014 NTT DATA Corporation

What is DevOps?

Mike Loukides, 2012, @Velocity conference

“If you're going to do operations reliably,

you need to make it reproducible and programmatic.”

Page 6: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

6Copyright © 2014 NTT DATA Corporation

What is DevOps?

• The nature of “operations”

• Growing distributed systems

• Software development practice

• “cooperation and collaboration” between dev and ops

Cloud changes

Page 7: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

7Copyright © 2014 NTT DATA Corporation

DevOps for developer

• Gap between Development and Operations

• Goals

• Process and approach

• Tools

• Infrastructure engineering becomes like a development.

• Infrastructure as a code

• Adoption of Vagrant

Page 8: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

8Copyright © 2014 NTT DATA Corporation

IntroductionTo Vagrant

Page 9: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

9Copyright © 2014 NTT DATA Corporation

What is Vagrant

• development environment on VM, container or cloud

• same

• among team members.

• among production and development.

• VirtualBox, AWS EC2

Page 10: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

10Copyright © 2014 NTT DATA Corporation

What is Vagrant

“Mature, stable, proven.”

by author,Mr. Mitchell Hashimoto

Page 11: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

11Copyright © 2014 NTT DATA Corporation

Targeted Vagrant Users

• Web application developers

CC-BY-ND by Tim Samoffhttps://www.flickr.com/photos/timsamoff/3248639569

Page 12: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

12Copyright © 2014 NTT DATA Corporation

New Vagrant Users

• Infrastructure engineer programmer

• Deploy on VMwarevCenter, OpenStack

• Test Puppet, Chef or Ansible

Page 13: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

13Copyright © 2014 NTT DATA Corporation

Vagrant work flow

• Just run

$ vagrant up

It download “vagrant box” and start and provision guest OS.

• Config file: “Vagrantfile”

Page 14: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

14Copyright © 2014 NTT DATA Corporation

What is Vagrant box

• Preconfigured VM images

• Base for environment

• Community shared

• VagrantCloud.com:shares boxes

CC-BY-ND by Renee Hawkhttps://flic.kr/p/a4QFRg

Page 15: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

15Copyright © 2014 NTT DATA Corporation

Brief history

• Launched at 2010

• 2013, March, Version 1.1+

• Plugins: 3rd party projects

• Vagrant-KVM plugin start

• 2014, March

• Vagrant Cloud

Page 16: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

16Copyright © 2014 NTT DATA Corporation

Vagrant provisioner

• Shell, Puppet, Ansible, Dockerand Chef

• 3rd party: Salt etc.

CC-BY by Quinn Dombowskihttps://flic.kr/p/6QWvrJ

Page 17: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

17Copyright © 2014 NTT DATA Corporation

Vagrant Plugins

• Supprted plugins from 1.1+(2013.2〜)

• Provider: Driver for VM monitor

• Provisioner: Configure guest images

• Synced_folder: folder sync between guest/host

Now we can made Vagrant workon my Linux and KVM!

Page 18: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

18Copyright © 2014 NTT DATA Corporation

Supported Providers

• Many provider plugins

VMWare

Sakura Cloud

Page 19: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

19Copyright © 2014 NTT DATA Corporation

Current status ofVagrant-KVM

Page 20: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

20Copyright © 2014 NTT DATA Corporation

Vagrant-KVM

Usage Vagrant provider plugin to utilize KVM

Auther Alexandre Drahon, UK

License MIT

Language Ruby

Vagrant-kvm

vagrant

libraries Ruby-libvirt, libvirt, qemu and kvm

Page 21: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

21Copyright © 2014 NTT DATA Corporation

Current Status of Vagrant-KVM

• V0.1.8 March, 2014

• Basic Vagrant features(private nw, NFS, provisioning, GUI, customize)

• Plan9 host file share

• QEMU 1.1 – 1.7

• V0.2.0 will come May, 2014

• Multiple guests and networks

• Bridged network

• Address conflict resolver

Page 22: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

22Copyright © 2014 NTT DATA Corporation

• kvm plugin: simple, single host

• libvirt plugin: multi-host, multi-vmm

Vagrant-KVM vs. -libvirt

Features Vagrant-KVM Vagrant-libvirt

KVM Yes Yes

Xen N.A. Plan

Remote N.A. Experimental

Multiple guests Yes Plan

File share Plan9, NFS NFS, rsync

Snapshot Yes(sahara) Yes(sahara)

Image convert Yes(mutate) Yes(mutate)

Multiple arch Plan N.A.

Current Version 0.1.8 0.0.16

Page 23: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

23Copyright © 2014 NTT DATA Corporation

Dependencies

UsageVirtualization abstraction library

Name libvirt

Language Ruby, C

Usage Ruby bridge to libvirt

Name Ruby-libvirt

Language C, C++

UsageVirtual Machine emulator

Name Qemu

Language C

Usage Test framework

Name rspec/mock

Language Ruby

• There are small amount of dependency.

Page 24: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

24Copyright © 2014 NTT DATA Corporation

Quality and Test

• Rspec to test the plugins

• Test vagrant-kvm in guest OS on KVM prepared by vagrant-kvm.

Vagrant

Vagrant-KVM

HostOSLibvirt/Qemu/KVM

GuestOSTarget KVM

GuestOSTarget KVM

Vagrantkvm

Dummyguest

Rspec/mock

Page 25: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

25Copyright © 2014 NTT DATA Corporation

Quality and Test

• CI: Github/Travis-CI combination

• Github.com: development platform

• Travis-CI: test automation platform

• RVM: Ruby Virtual Machinesprepare versions of ruby

Page 26: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

26Copyright © 2014 NTT DATA Corporation

OSS and CI

• Every commit/patch and PRs are tested with Travis-CI and Rspec.

Github.comPull-Request example: Green

Page 27: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

27Copyright © 2014 NTT DATA Corporation

OSS and CI

• Every commit/patch and PRs are tested with Travis-CI and Rspec.

Travis-CI.org: Test history

Page 28: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

28Copyright © 2014 NTT DATA Corporation

Issues fixed

No Component Problem Resolution

1 libvirt security treatment for plan9 file share

Dynamic AppArmor policy update

External SELinux label control work around

Dynamic permission control not to restore permission

Lack of restore function in libvirt.Work around in a plugin.

2 Ruby-libvirt Not updated 2 yrs. Unsupported new API

Push developer to update. Release 0.5.x in Dec. 2013

3 Linux kernel Fail to configure AppArmor rule Wait kernel update

4 CentOS6 Unsupported plan9fs (not configured in kernel)

Provide special VM image.

There are many issues to be fixed in related projects.

Page 29: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

29Copyright © 2014 NTT DATA Corporation

Vagrant-kvm: Future plan

• Support full features of Vagrant

• Multiple architecture(ARM)

• Linux kernel debug support

CC-BY by Simon Cuninghamhttps://flic.kr/p/iU3qg9

Page 30: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

30Copyright © 2014 NTT DATA Corporation

Change the way:infrastructure

Page 31: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

31Copyright © 2014 NTT DATA Corporation

New trend on DevOps

• Infrastructure development isChanging

• New technology comes on Infrastructure Engineering / development

Page 32: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

32Copyright © 2014 NTT DATA Corporation

Blue Green Deployment

http://www.nttdata.com/jp/ja/insights/trend_keyword/2013122601.html

No change to production environment New/Change for environment => create new instance and switch it

Destroy after switch

Before deploy

Post deploy

Router

Router

Application Server

Ver 1

Application Server

Ver 1

Application Server

Ver 1

Application Server

Ver 1

Application Server Ver2

DatabaseVer2

Application Server Ver2

DatabaseVer2

Active

Deployment

Switch back when fail

ActiveDirect Green

Page 33: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

33Copyright © 2014 NTT DATA Corporation

Packaging for deploy

• Application container help agile deployment of Application

Production

Development

Bare Metal

Linux Container

Master Image

試験 difference

Temploraryconfiguration

Update master

Same environment deploymentFresh deployment

everyday

Application container(Packer) technology

Virtual Machines

InstanceTo run

Page 34: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

34Copyright © 2014 NTT DATA Corporation

Packer

• http://www.packer.io/

• Create virtual machine image for several kind of cloud / virtulization infrastructures.

• Use JSON as profile description language.

• Infra can be managed as same as source code.

34

Page 35: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

35Copyright © 2014 NTT DATA Corporation

Packer

Usage Multi platform VM image build tool

Origin HashiCorp

License Mozilla Public License Version 2.0

Language Go

DefinisionFile

(JSON) packer

Virtual BOXSingle definition made multipleimages for platforms

Provisioning tool

Page 36: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

36Copyright © 2014 NTT DATA Corporation

Docker

• Portable container for Application

36

https://www.docker.io/

Agility:Low overhead and quick setup

Portability:

dependency packed into container image.

Page 37: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

37Copyright © 2014 NTT DATA Corporation

Vagrant and Docker

• Prepare Docker environment on Vagrant

• Auto detect guest OS and install proper packages.

• Start Docker environment only one line command.

Vagrant 1.5+ Provisioner

Vagrant 1.6+ Provisioner/Provider

Page 38: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

38Copyright © 2014 NTT DATA Corporation

Stack of DevOps infrastructure

Vagrant enables control over infrastructure tool sets

Page 39: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

39Copyright © 2014 NTT DATA Corporation

Work flow example(1/2)

Creation of Guest Images

Page 40: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

40Copyright © 2014 NTT DATA Corporation

Work flow example(2/2)

Test on local Virtual Machines

Then run on production

Page 41: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

41Copyright © 2014 NTT DATA Corporation

Future

Page 42: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

42Copyright © 2014 NTT DATA Corporation

Future of Vagrant/vagrant-kvm

• Embedded development with ARM support

• Various cloud and private platform support

• Packer/Docker integration

• Test automation

Page 43: DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr ... · Vagrant-KVM vs. -libvirt Features Vagrant-KVM Vagrant-libvirt KVM Yes Yes Xen N.A. Plan Remote N.A. Experimental ...

Copyright © 2011 NTT DATA Corporation

Copyright © 2013 NTT DATA Corporation

Contact

miurahr at nttdata co jp@miurahr (Twitter/LinkedIn/Github)