TXLF: Automated Deployment of OpenStack with Chef

83
Texas Linux Fest April 2, 2011 Automated Deployment of OpenStack with Chef 1

description

Automated Deployment of OpenStack with Chef talk given April 2, 2011 at the Texas Linux Fest.

Transcript of TXLF: Automated Deployment of OpenStack with Chef

Page 1: TXLF: Automated Deployment of OpenStack with Chef

Texas Linux FestApril 2, 2011

Automated Deployment of OpenStack with Chef

1

Page 2: TXLF: Automated Deployment of OpenStack with Chef

Introductions

Matt Ray

Senior Technical Evangelist

[email protected]

@mattray

GitHub:mattray

2

Page 3: TXLF: Automated Deployment of OpenStack with Chef

What is OpenStack?

3

Page 4: TXLF: Automated Deployment of OpenStack with Chef

But do we really have to choose?

NASA Founders operate at

massive scale

4

Page 5: TXLF: Automated Deployment of OpenStack with Chef

OpenStack: The Mission

"To produce the ubiquitous Open Source cloud computing platform that will meet the needs of public and private cloud providers regardless of size, by being simple to implement and massively scalable."

5

Page 6: TXLF: Automated Deployment of OpenStack with Chef

OpenStack Founding Principles

Apache 2.0 license (OSI), open development process

Open design process, 2x year public Design Summits

Publicly available open source code repositories

Open community processes documented and transparent

Commitment to drive and adopt open standards

Modular design for deployment flexibility via APIs

6

Page 7: TXLF: Automated Deployment of OpenStack with Chef

Community with Broad Support

7

Page 8: TXLF: Automated Deployment of OpenStack with Chef

creating open source software to build public and private

clouds

Software to provision virtual machines on standard hardware at massive scale

OpenStack Compute

Software to reliably store billions of objects distributed across standard hardware

OpenStack Object Storage

8

Page 9: TXLF: Automated Deployment of OpenStack with Chef

Asynchronous eventually consistent

communication

ReST-based API

Horizontally and massively scalable

Hypervisor agnostic: support for Xen ,XenServer, Hyper-V,

KVM, UML and ESX is coming Hardware agnostic: standard hardware, RAID not required

OpenStack Compute Key Features

9

Page 10: TXLF: Automated Deployment of OpenStack with Chef

API: Receives HTTP requests, converts commands to/from API format, and sends requests to cloud controller

Cloud Controller: Global state of system, talks to LDAP, OpenStack Object Storage, and node/storage workers through a queue

User Manager

ATAoE / iSCSI

Host Machines: workers that spawn instances

Glance: HTTP + OpenStack Object Storage for server images OpenStack Compute

10

Page 11: TXLF: Automated Deployment of OpenStack with Chef

Hardware Requirements

OpenStack is designed to run on industry standard hardware, with flexible configurations

Computex86 Server (Hardware Virt. recommended)Storage flexible (Local, SAN, NAS)

Object Storagex86 Server (other architectures possible)Do not deploy with RAID (can use controller for cache)

11

Page 12: TXLF: Automated Deployment of OpenStack with Chef

Why is OpenStack important?

Open eliminates vendor lock-in

Working together, we all go faster

Freedom to federate, or move between clouds

12

Page 13: TXLF: Automated Deployment of OpenStack with Chef

What is Chef?

13

Page 14: TXLF: Automated Deployment of OpenStack with Chef

Chef enables Infrastructure as Code

Manage configuration as idempotent Resources.

Put them together in Recipes.

Track it like Source Code.

Configure your servers.

14

Page 15: TXLF: Automated Deployment of OpenStack with Chef

At a High Level

Library for configuration management

Configuration management system

Systems integration platform

API for your entire Infrastructure

15

Page 16: TXLF: Automated Deployment of OpenStack with Chef

Fully automated Infrastructure

16

Page 17: TXLF: Automated Deployment of OpenStack with Chef

Principles

IdempotentData-drivenSane defaultsHackabilityTMTOWTDI

17

Page 18: TXLF: Automated Deployment of OpenStack with Chef

Open Source and Community

Apache 2 licensed

Large and active community

Over 300 individual contributors (60+ corporate)

Community is Important!

18

Page 19: TXLF: Automated Deployment of OpenStack with Chef

19

Page 20: TXLF: Automated Deployment of OpenStack with Chef

How does it Work?

20

Page 21: TXLF: Automated Deployment of OpenStack with Chef

How does it Work?Miracles!

21

Page 22: TXLF: Automated Deployment of OpenStack with Chef

How does it Work?Miracles!(no really)

22

Page 23: TXLF: Automated Deployment of OpenStack with Chef

Chef Client runs on your System

23

Page 24: TXLF: Automated Deployment of OpenStack with Chef

Chef Client runs on your System

ohai!

24

Page 25: TXLF: Automated Deployment of OpenStack with Chef

Clients talk to the Chef Server

25

Page 26: TXLF: Automated Deployment of OpenStack with Chef

The Opscode Platform is a hosted Chef Server

26

Page 27: TXLF: Automated Deployment of OpenStack with Chef

We call each system you configure a

Node

27

Page 28: TXLF: Automated Deployment of OpenStack with Chef

Nodes have Attributes{ "kernel": { "machine": "x86_64", "name": "Darwin", "os": "Darwin", "version": "Darwin Kernel Version 10.4.0: Fri Apr 23 18:28:53 PDT 2010; root:xnu-1504.7.4~1/RELEASE_I386", "release": "10.4.0" }, "platform_version": "10.6.4", "platform": "mac_os_x", "platform_build": "10F569", "domain": "local", "os": "darwin", "current_user": "mray", "ohai_time": 1278602661.60043, "os_version": "10.4.0", "uptime": "18 days 17 hours 49 minutes 18 seconds", "ipaddress": "10.13.37.116", "hostname": "morbo", "fqdn": "morbomorbo.local", "uptime_seconds": 1619358 }

Kernel info!

Platform info!

Hostname and IP!

28

Page 29: TXLF: Automated Deployment of OpenStack with Chef

Nodes have a Run List

What Roles and Recipes to Apply in Order

29

Page 30: TXLF: Automated Deployment of OpenStack with Chef

Nodes have Roles

webserver, database, monitoring, etc.

30

Page 31: TXLF: Automated Deployment of OpenStack with Chef

Roles have a Run List

What Roles and Recipes to Apply in Order

31

Page 32: TXLF: Automated Deployment of OpenStack with Chef

32

name "webserver"description "Systems that serve HTTP traffic"

run_list( "role[base]", "recipe[apache2]", "recipe[apache2::mod_ssl]")

default_attributes( "apache" => { "listen_ports" => [ "80", "443" ] })

override_attributes( "apache" => { "max_children" => "50" })

32

Page 33: TXLF: Automated Deployment of OpenStack with Chef

32

name "webserver"description "Systems that serve HTTP traffic"

run_list( "role[base]", "recipe[apache2]", "recipe[apache2::mod_ssl]")

default_attributes( "apache" => { "listen_ports" => [ "80", "443" ] })

override_attributes( "apache" => { "max_children" => "50" })

Can includeother roles!

32

Page 34: TXLF: Automated Deployment of OpenStack with Chef

Chef manages Resources on Nodes

33

Page 35: TXLF: Automated Deployment of OpenStack with Chef

Declare a description of the state a part of the node should be in

Resources

34

Page 36: TXLF: Automated Deployment of OpenStack with Chef

package "apache2" do version "2.2.11-2ubuntu2.6" action :installend

template "/etc/apache2/apache2.conf" do source "apache2.conf.erb" owner "root" group "root" mode 0644 action :createend

Declare a description of the state a part of the node should be in

Resources

34

Page 37: TXLF: Automated Deployment of OpenStack with Chef

‣ Have a type package "apache2" do version "2.2.11-2ubuntu2.6" action :installend

template "/etc/apache2/apache2.conf" do source "apache2.conf.erb" owner "root" group "root" mode 0644 action :createend

Declare a description of the state a part of the node should be in

Resources

34

Page 38: TXLF: Automated Deployment of OpenStack with Chef

‣ Have a type

‣ Have a name

package "apache2" do version "2.2.11-2ubuntu2.6" action :installend

template "/etc/apache2/apache2.conf" do source "apache2.conf.erb" owner "root" group "root" mode 0644 action :createend

Declare a description of the state a part of the node should be in

Resources

34

Page 39: TXLF: Automated Deployment of OpenStack with Chef

‣ Have a type

‣ Have a name

‣ Have parameters

package "apache2" do version "2.2.11-2ubuntu2.6" action :installend

template "/etc/apache2/apache2.conf" do source "apache2.conf.erb" owner "root" group "root" mode 0644 action :createend

Declare a description of the state a part of the node should be in

Resources

34

Page 40: TXLF: Automated Deployment of OpenStack with Chef

‣ Have a type

‣ Have a name

‣ Have parameters

‣ Take action to put the resource in the declared state

package "apache2" do version "2.2.11-2ubuntu2.6" action :installend

template "/etc/apache2/apache2.conf" do source "apache2.conf.erb" owner "root" group "root" mode 0644 action :createend

Declare a description of the state a part of the node should be in

Resources

34

Page 41: TXLF: Automated Deployment of OpenStack with Chef

Resources take action through Providers

35

Page 42: TXLF: Automated Deployment of OpenStack with Chef

Recipes are lists of Resources

36

Page 43: TXLF: Automated Deployment of OpenStack with Chef

Evaluate and apply Resources in the order they appear

Recipes

package "apache2" do version "2.2.11-2ubuntu2.6" action :installend

template "/etc/apache2/apache2.conf" do source "apache2.conf.erb" owner "root" group "root" mode 0644 action :createend

1

2

37

Page 44: TXLF: Automated Deployment of OpenStack with Chef

Order Matters

38

Page 45: TXLF: Automated Deployment of OpenStack with Chef

Recipes are just Ruby!

extra_packages = case node[:platform] when "ubuntu","debian" %w{ ruby1.8 ruby1.8-dev rdoc1.8 ri1.8 libopenssl-ruby } end

extra_packages.each do |pkg| package pkg do action :install endend

39

Page 46: TXLF: Automated Deployment of OpenStack with Chef

Cookbooks are packages for Recipes

40

Page 47: TXLF: Automated Deployment of OpenStack with Chef

Cookbooks

Distributable, shareable

comunity.opscode.com

Infrastructure as Code

Versioned

Hundreds

41

Page 48: TXLF: Automated Deployment of OpenStack with Chef

Cookbooks

Recipes

Files

Templates

Attributes

Metadata

42

Page 49: TXLF: Automated Deployment of OpenStack with Chef

Data bags store arbitrary data

43

Page 50: TXLF: Automated Deployment of OpenStack with Chef

A user data bag item...% knife data bag show users mray{ "comment": "Matt Ray", "groups": "sysadmin", "ssh_keys": "ssh-rsa SUPERSEKRATS mray@morbo", "files": { ".bashrc": { "mode": "0644", "source": "dot-bashrc" }, ".emacs": { "mode": "0644", "source": "dot-emacs" } }, "id": "mray", "uid": 7004, "shell": "/usr/bin/bash" }

44

Page 51: TXLF: Automated Deployment of OpenStack with Chef

Environments manage versioned infrastructure

45

Page 52: TXLF: Automated Deployment of OpenStack with Chef

Copyright © 2011 Opscode, Inc - All Rights Reserved

Command-line API utility, Knife

46http://www.flickr.com/photos/myklroventine/3474391066/

46

Page 53: TXLF: Automated Deployment of OpenStack with Chef

$ knife search node 'platform:ubuntu'

search(:node, ‘platform:centos’)

$ knife search role 'max_children:50'

search(:role, ‘max_children:50’)

$ knife search node ‘role:webserver’

search(:node, ‘role:webserver’)

$ knife users ‘shell:/bin/bash’

search (:users, ‘group:sysadmins’)

Search

‣CLI or in Ruby

‣Nodes are searchable

‣Roles are searchable

‣Recipes are searchable

‣Data bags are searchable

47

Page 54: TXLF: Automated Deployment of OpenStack with Chef

48

Page 55: TXLF: Automated Deployment of OpenStack with Chef

HOW TO: Turn Racks of Standard Hardware Into a

Cloud with OpenStack

49

Page 56: TXLF: Automated Deployment of OpenStack with Chef

What Works Today?

50

Page 57: TXLF: Automated Deployment of OpenStack with Chef

Compute (Nova)

Single machine installation

‣ Role: nova-single-machine

‣ MySQL, RabbitMQ

‣ Nova-(api|scheduler|network|objectstore|compute)

Multi-machine

‣ Role: nova-multi-controller (1)

‣ Role: nova-multi-compute (N)

51

Page 58: TXLF: Automated Deployment of OpenStack with Chef

name "nova-single-machine-install"

description "Installs everything required to run Nova on a single machine"

run_list( "role[nova-multi-controller]", "role[nova-multi-compute]" )

Role: nova-single-machine

52

Page 59: TXLF: Automated Deployment of OpenStack with Chef

name "nova-multi-controller"

description "Installs requirements to run the Controller node in a Nova cluster"

run_list( "role[nova-support-server]", "role[nova-head]", "role[nova-cloud-controller]", "role[nova-super-user-setup]" )

Role: nova-multi-controller

53

Page 60: TXLF: Automated Deployment of OpenStack with Chef

name "nova-multi-compute"

description "Installs requirements to run a Compute node in a Nova cluster"

run_list( "recipe[nova::compute]")

Role: nova-multi-compute

54

Page 61: TXLF: Automated Deployment of OpenStack with Chef

What does this look like?

55

Page 62: TXLF: Automated Deployment of OpenStack with Chef

Crowbar

‣Codename for the OpenStack installer from Dell

‣Dell is releasing this under the Apache 2 license

‣Extension of the Chef server

‣Jointly developed by Dell, Rackspace and Opscode

56

Page 63: TXLF: Automated Deployment of OpenStack with Chef

Crowbar - What does it Do?

‣Crowbar is a PXE state machine

‣ starts with bare metal hardware

‣manages and configures BIOS and network settings

‣ network boot and installation

‣ nodes are configured with Chef

‣ deploys OpenStack, could be used for anything

57

Page 64: TXLF: Automated Deployment of OpenStack with Chef

$ knife cookbook upload -a$ knife cookbook list$ rake roles$ knife role list$ knife node list

OpenStack Installation

‣Cookbooks uploaded

‣Roles uploaded

‣Nodes ready

58

Page 65: TXLF: Automated Deployment of OpenStack with Chef

name "nova-ami-urls"description "Feed in a list URLs for AMIs to download"default_attributes( "nova" => { "images" => ["http://192.168.11.7/ubuntu1010-UEC-localuser-image.tar.gz”] } )

$ knife role from file roles/nova-ami-urls.rb

AMIs

‣Use an existing AMI

‣Update URL to your own

59

Page 66: TXLF: Automated Deployment of OpenStack with Chef

$ knife node run_list add crushinator.localdomain "role[nova-ami-urls]" { "run_list": [ "role[nova-ami-urls]" ]}

$ knife node run_list add crushinator.localdomain "role[nova-single-machine-install]"{ "run_list": [ "role[nova-ami-urls]" "role[nova-single-machine-install]", ]}

Assign the Roles

60

Page 67: TXLF: Automated Deployment of OpenStack with Chef

mray@ubuntu1010:~$ sudo chef-client[Fri, 25 Feb 2011 11:52:59 -0800] INFO: Starting Chef Run (Version 0.9.12)...[Fri, 25 Feb 2011 11:56:05 -0800] INFO: Chef Run complete in 5.911955 seconds[Fri, 25 Feb 2011 11:56:05 -0800] INFO: cleaning the checksum cache[Fri, 25 Feb 2011 11:56:05 -0800] INFO: Running report handlers[Fri, 25 Feb 2011 11:56:05 -0800] INFO: Report handlers complete

chef-client

61

Page 68: TXLF: Automated Deployment of OpenStack with Chef

nova@$ nova-manage service list

nova@$ euca-describe-images

nova@$ euca-run-instances ami-h8wh0j17 -k mykey -t m1.tiny

nova@$ euca-describe-instances

nova@$ ssh -i mykey.priv [email protected]

Linux i-00000001 2.6.35-24-virtual #42-Ubuntu SMP Thu Mar 30 05:15:26 UTC 2011 x86_64 GNU/LinuxUbuntu 10.10

Welcome to Ubuntu!<SNIP>See "man sudo_root" for details.

ubuntu@i-00000001:~$

The Moment of Truth

62

Page 69: TXLF: Automated Deployment of OpenStack with Chef

How Did We Get Here?

63

Page 70: TXLF: Automated Deployment of OpenStack with Chef

Forked from Anso Labs’ Cookbooks

Bootstrapped by Opscode

Chef Solo/Vagrant installs for Developers

http://github.com/ansolabs/openstack-cookbooks

64

Page 71: TXLF: Automated Deployment of OpenStack with Chef

Who’s involved so far?

65

Page 72: TXLF: Automated Deployment of OpenStack with Chef

What’s Next?

66

Page 73: TXLF: Automated Deployment of OpenStack with Chef

Nova needed enhancements

Pluggable/Modular Roles

‣Database

‣ObjectStore

‣Network

‣Virtualization

Swift and Glance integration

67

Page 74: TXLF: Automated Deployment of OpenStack with Chef

68

Page 75: TXLF: Automated Deployment of OpenStack with Chef

Dashboard

69

Page 76: TXLF: Automated Deployment of OpenStack with Chef

Knife

‣ http://github.com/opscode/knife-openstack

‣ Nova has same API as Amazon

‣ Fog supports OpenStack already

‣knife openstack server create ‘role[base]’ -i ami-a403f6xd -f m1.micro -A “OpenStack instance”

70

Page 77: TXLF: Automated Deployment of OpenStack with Chef

Object Storage (Swift)

‣ Recipes originated from Anso Labs’ repository

‣Will be managed with Chef and Crowbar

‣ Included in the ‘bexar’ branch

‣ Untested so far (Cactus will tackle)

71

Page 78: TXLF: Automated Deployment of OpenStack with Chef

Image Registry (Glance)

‣ Recipes originated from Anso Labs’ repository

‣Will be managed with Chef and Crowbar

‣ Included in the ‘bexar’ branch

‣ Untested so far (Cactus!)

72

Page 79: TXLF: Automated Deployment of OpenStack with Chef

Scaling changes how we deploy OpenStack!

73

Page 80: TXLF: Automated Deployment of OpenStack with Chef

Deployment Scenarios

‣ Single machine is special case of multi-install

‣ Controller + Compute nodes is a known quantity for small installations

‣ Nova + Swift + Glance in large installations

‣ Services separated and HA configurations supported

‣ Documentation and Chef Roles will be the solution

74

Page 81: TXLF: Automated Deployment of OpenStack with Chef

Cactus, Diablo, ...

Development continues...

Branches for each stable release

Design Summit later this month

Design Summit in the Fall

75

Page 82: TXLF: Automated Deployment of OpenStack with Chef

Rackspace Cloud Builders

Commercial support and Training for OpenStack

‣ Opscode

‣ Dell

‣ Equinix

‣ Cloudscaling

‣ Citrix

76