ironic - a modern approach to machine deployment

38
IRONIC A MODERN APPROACH TO MACHINE DEPLOYMENT DEVANANDA VAN DER VEEN @DEVANANDA GITHUB.COM/DEVANANDA/TALKS

Upload: devananda-van-der-veen

Post on 16-Aug-2015

206 views

Category:

Technology


4 download

TRANSCRIPT

Page 1: Ironic - A modern approach to machine deployment

IRONICA MODERN APPROACH

TO MACHINE DEPLOYMENTDEVANANDA VAN DER VEEN

@DEVANANDA

GITHUB.COM/DEVANANDA/TALKS

Page 2: Ironic - A modern approach to machine deployment

ABOUT

Performance ConsultantEngineer @ HP CloudLikes interactive audiencesFavorite whisky: Nikka

Page 3: Ironic - A modern approach to machine deployment

Observation:

Every company has their own PXE-based installation framework

Binary image copy improves repeatability and reduces entropy

So why not do this for bare metal, too?

Page 4: Ironic - A modern approach to machine deployment

Ironically, a physical machine behaves a lot like a VM or a container

Based on the name, you might have expected that joke

Page 5: Ironic - A modern approach to machine deployment
Page 6: Ironic - A modern approach to machine deployment
Page 7: Ironic - A modern approach to machine deployment

Build and customize your own images

$ pip install diskimage­builder

$ disk­image­create ­o my­image ­t qcow2 ­a amd64 \    ubuntu vm serial­console cloud­init­datasources

"vm" element creates partition table and installs abootloader

Don't ask me why it's called "vm"

Page 8: Ironic - A modern approach to machine deployment

You can build your own deploy ramdisk

Or download a and imagefrom our build server

$ pip install diskimage­builder

$ ramdisk­image­create ­o my­ramdisk ­a amd64 \    ubuntu deploy­ironic

kernel ramdisk

http://tarballs.openstack.org/ironic-python-agent/coreos/files

Page 9: Ironic - A modern approach to machine deployment

STANDARD PROTOCOLSPower

IPMI: intelligent platform management interface, forremote control of machine power state, boot device,serial console, etc.SNMP: simple network management protocol, often usedwith Power Distribution Units for remote control of powerstatus.

Page 10: Ironic - A modern approach to machine deployment

STANDARD PROTOCOLSBoot

DHCP: dynamic host configuration protocol, used tolocate the NBP on the network, and provide the host OSwith IP address during initTFTP: trivial file transfer protocol, copies the NBP over thenetworkPXE: pre-boot execution environment, allows host to bootfrom network[g,i]PXE: recent enhancements make PXE more flexible,supported on most hardware

Page 11: Ironic - A modern approach to machine deployment

IPMI HAS NOT SIGNIFICANTLYCHANGED IN THE LAST 10 YEARS

Meanwhile, vendors continue to add new (and different!) capabilities to their management controllers,

each with different protocols

Page 12: Ironic - A modern approach to machine deployment

A new standard is in the works (RedFish)but software will continue to change

faster than hardware standards

Page 13: Ironic - A modern approach to machine deployment

Vendor value is derived from quality ofhardware, services, support, and integration

not from proprietary solutions to common problems

Page 14: Ironic - A modern approach to machine deployment

ARCHITECTURE

Page 15: Ironic - A modern approach to machine deployment

SERVICE COMPONENTS

Page 16: Ironic - A modern approach to machine deployment

DRIVER API

Page 17: Ironic - A modern approach to machine deployment

This gives driver authors a lot of simplicity flexibility

While the REST API provides common abstraction forprovisioning a pool of servers

repeatably

regardless of vendor

Page 18: Ironic - A modern approach to machine deployment

Resource types: Node, Port, Driver (*)

Documentation is continually built from sourceand packaged with each release

REST API

docs.openstack.org/developer/ironic/webapi/v1.html

(*) There is a fourth resource type, "chassis". This is a remnant of early designs, and doesn't performa meaningful function today

Page 19: Ironic - A modern approach to machine deployment

GET /v1/nodes/{   "nodes" : [      {         "name" : "nuc",         "maintenance" : false,         "instance_uuid" : null,         "power_state" : "power off",         "uuid" : "ba031dea­e7a8­4917­89f1­0f3ad31344ee",         "provision_state" : "available"         "links" : [            {               "href" : "http://127.0.0.1:6385/v1/nodes/ba031dea­e7a8­4917­89f1­0f3ad31344ee"               "rel" : "self"            },            {               "rel" : "bookmark",               "href" : "http://127.0.0.1:6385/nodes/ba031dea­e7a8­4917­89f1­0f3ad31344ee"

Page 20: Ironic - A modern approach to machine deployment

GET /v1/nodes/ba031dea-e7a8-4917-89f1-0f3ad31344ee{   "name" : "nuc",                                      # human readable name   "uuid" : "ba031dea­e7a8­4917­89f1­0f3ad31344ee",     # canonical reference   "driver" : "pxe_amt",                                # hardware driver   "properties" : {                                     # hardware characteristics      "ram" : 8096,      "cpu_arch" : "x86_64",      "cpus" : 2,      "disk_size" : 500   },   "driver_info" : {                                    # driver management data      "amt_password" : "******",      "amt_address" : "192.168.2.3",      "amt_username" : "admin"   },   "power_state" : "power off",                         # last known power state   "target_power_state" : null,                         # non­null if change requested

Page 21: Ironic - A modern approach to machine deployment

Every driver is differentand requires specific attributesdriver_info

You enter this once, when enrolling the Node

Read the driver's documentationOr discover it from the API

Page 22: Ironic - A modern approach to machine deployment

GET /v1/drivers/ /propertiesdrivername{   "ilo_username" : "username for the iLO with administrator privileges. Required."   "client_timeout" : "timeout (in seconds) for iLO operations. Optional."   "ilo_address" : "IP address or hostname of the iLO. Required.",   "deploy_ramdisk" : "UUID (from Glance) of the ramdisk that is mounted at boot time. Required."   "console_port" : "node's UDP port to connect to. Only required for console access."   "ilo_change_password" : "new password for iLO. Required if the clean step 'reset_ilo_credential' is enabled."   "deploy_kernel" : "UUID (from Glance) of the deployment kernel. Required."   "client_port" : "port to be used for iLO operations. Optional.",   "ilo_password" : "password for ilo_username. Required."}{   "snmp_outlet" : "PDU power outlet index (1­based).  Required.",   "snmp_version" : "SNMP protocol version: 1, 2c, 3  (optional, default 1)"   "snmp_driver" : "PDU manufacturer driver.  Required.",   "snmp_port" : "SNMP port, default 161",   "snmp_address" : "PDU IPv4 address or hostname.  Required.",

Page 23: Ironic - A modern approach to machine deployment

Instances are assumed to be different.Therefore, is cleared after instance

deletion.instance_info

Page 24: Ironic - A modern approach to machine deployment

Vendors can implement additional capabilities which are to their driver.passed directly

These are implemented at:

/v1/drivers/NAME/vendor_passthru//v1/nodes/UUID/vendor_passthru/

In practice, this is little used, as driversare encouraged to converge into a common API.

Page 25: Ironic - A modern approach to machine deployment

This is just an example.Different drivers do things differently, after all.

DEPLOYMENT SEQUENCE

Page 26: Ironic - A modern approach to machine deployment
Page 27: Ironic - A modern approach to machine deployment
Page 28: Ironic - A modern approach to machine deployment

PROVISIONING STATE MACHINE

STATE- stable (or passive) state

R:verb- request that begins a transition

[STATE*/TARGET]- active, momentary, or error state

Page 29: Ironic - A modern approach to machine deployment

Progress is reflected in the API   "power_state" : "power on",                          # last known power state   "target_power_state" : null,                         # non­null if   "provision_state" : "deploying",                     # current provision state   "target_provision_state" : "active",                 # last requested provision state   "updated_at" : "2015­06­02T19:39:04+00:00",          # exposed timing data   "reservation" : Leni,                                # exposed lock status

Page 30: Ironic - A modern approach to machine deployment

PROVISIONING STATE MACHINE(it's always more complicated than you expect)

Page 31: Ironic - A modern approach to machine deployment

Use Ansible for automationSeparate and reusable playbooks

KEEPING IT SIMPLE

Page 32: Ironic - A modern approach to machine deployment
Page 33: Ironic - A modern approach to machine deployment

First things first: input environment vars$ cat bifrost/playbooks/inventory­­­node_default_network_interface: eth0network_interface: eth2ipv4_subnet_mask: 255.255.255.0ipv4_gateway: 192.168.1.1ipv4_nameserver: 8.8.8.8dhcp_pool_start: 192.168.2.200dhcp_pool_end: 192.168.2.250deploy_kernel: "{{http_boot_folder}}/coreos_production_pxe.vmlinuz"deploy_ramdisk: "{{http_boot_folder}}/coreos_production_pxe_image­oem.cpio.gz"deploy_image_filename: "deployment_image.qcow2"deploy_image: "{{http_boot_folder}}/{{deploy_image_filename}}"                    

Page 34: Ironic - A modern approach to machine deployment

installs external dependencies, configures your environmentInstall

$ bash ./scripts/env­setup.sh$ source /opt/stack/ansible/hacking/env­setup$ cd playbooks

$ ansible­playbook ­K ­vvvv ­i inventory/localhost install.yaml

Page 35: Ironic - A modern approach to machine deployment

supply inventory file

ORuse CLI to create Nodes, Ports

Enroll

$ ansible­playbook ­vvvv ­i inventory/localhost enroll.yaml \    ­e baremetal_csv_file=baremetal.csv

$ ironic node­create ­d agent_amttool ­n nuc \    ­i amt_password='Pa$$w0rd' ­i amt_address='192.168.2.3' ­i amt_username=    ­p cpu_arch=x86_64 ­p local_gb=64 ­p memory_mb=8192 ­p cpus=2 \    ­i deploy_ramdisk='http://192.168.2.2:8080/coreos_production_pxe_image­oem.cpio.gz'    ­i deploy_kernel='http://192.168.2.2:8080/coreos_production_pxe.vmlinuz'

$ ironic port­create ­n $UUID ­a ec:a8:6b:fe:e1:b0

Page 36: Ironic - A modern approach to machine deployment

reads inventory fileOR

gathers list from Ironic directly

then populates and starts the deploy

Deploy

$ ansible­playbook ­vvvv ­i inventory/bifrost_inventory.py \    deploy­dynamic.yaml

instance_info

Page 37: Ironic - A modern approach to machine deployment

OPENSTACK?

Page 38: Ironic - A modern approach to machine deployment

@devananda

THANKS!

devananda.github.io/talks

github.com/openstack/ironicgithub.com/openstack/bifrost