Cloud init and cloud provisioning [openstack summit vancouver]
-
Upload
joshua-harlow -
Category
Technology
-
view
396 -
download
2
Transcript of Cloud init and cloud provisioning [openstack summit vancouver]
Scott Moser <[email protected]>Josh Harlow <[email protected]>
Evil Superuser’s HOWTO:Launching Instances to do your bidding
Cloud Init In...
?
Quick deep[ish]-dive
$ nova boot --user-data=user-data.txt --key-name=cubfan@ubuntu --flavor=m1.large \ --image=Ubuntu-14.04-x86_64 my-servername
Quick overview of Cloud Instance LaunchSelect an Image
Ubuntu 14.04 or Windows Server 2008 or RedHat ...Choose size / flavor
m1.large = 2xCPU + 8GB memm3.tiny = 1xCPU + 768G mem
Select networks attached / external addressabilityOpen port 22 and port 80
Select ssh keysWho should be allowed in?
Click
OpenStack Metadata Sources
/metadata.json/userdata/vendordata.json
/metadata.json /userdata /vendordata.json
your-vm.openstack
http://169.254.169.254/latest
Metadata Service
Config Drive
https://gist.github.com/harlowja/3e9ae39c0e8f70e702b6 (ex: config drive layout)
https://gist.github.com/harlowja/0f5e5c57f9d21b084e7f (ex: metadata json blob)
OK, I launched an instance, now what?
I need●puppet●chef●ansible●ssh <host>●installed package XYZ●...
How do I get these??●Well cloud-init man (not smoser)
can help!
What is user-dataAlso known as Instance Customization Data
Allows a single “image” to behave differently
Simple:#!/bin/shecho “Hi Mom”
More Complex (via YAML):#cloud-configpackages: [pastebinit]runcmd: - echo “Hi Mom” | tee /run/greeting.log | pastebinit
How it can be quite useful
●Store common user-data(s) in an external repo (ie, GIT) and combine into a VM/machine/compute instance at a later point
●Creates a repository of common patterns that can be shared and reviewed separately (inherent decoupling)
●Creates a clear boundary between instances and what they eventually become when initialized
●Cross-platform (to some degree)●Making the same common user-data/patterns work across
machine types, operating system types…
What happens (at a high-level)
Init:Read from datasource (or use prior datasource)Fetch & save instance-data (userdata, metadata, ...)May write network configurationConsume user-data (expanding it…)Run init (sections) modulesConfig:Run config (sections) modulesFinal:Run final (sections) modules
Runs in various stages
Cloud-init’s take on user-data
Can be multi-part●Input in mime multipart format or cloud-config-
archive format (yaml/json list)●'#include' support
●Allows for including external urls…●Useful for merging in large user-data from external
sources...Separates configuration and codeProcessed via pluggable modulesExtensible via user-data
●Add your own ‘part-handlers’●Change config that is built into system
Input Formats
gzipped content: save you some bytesmime multipart: archive format containing any of theseuser-script: script will be executed at "rc.local-like"include url: #include http://another.example.com/resourcecloud-config: yaml format (primary format)upstart jobcloud-boothook: scripts run very earlypart-handler: python module loaded and able to handle subsequent parts
Userdata (real-life) examples
- Upgrade, reboot if necessary- https://goo.gl/h9IBy0
- Adding an initial user (with ssh-keys)- https://goo.gl/TB08MY
- Using mime multipart- https://goo.gl/0BbKOm
- Chef + yahoo (real example from chef group)- https://goo.gl/tJUCXK
- Chef + yahoo.2 (real example from a different group)
- https://goo.gl/NyQ5ga
- Benchmark things (real example)- https://goo.gl/u1wKr7
What else does Cloud-init do?
●import ssh keys●grow the root partition●add [default] user(s)/group(s)●hostname●timezone●mount points●distro packaging items: mirror selection, additional
package archives, packages, upgrade●ssh public keys, ssh private [host keys]●phone home (useful for on completion callbacks)●seed your machines entropy source (/dev/urandom)●More info: doc/examples/●More modules
Data Sources (Cloud Providers)
AzureCloudStackOpenStack
● ConfigDrive (r/o ISO9600/VFAT)● MD/UD REST API (similar to EC2 variant)
DigitalOceanEC2Google Compute (GCE)MAASNoCloudOpenNebulaOVFSmartOS [Joyent]
How and who provides data (for cloud-init to use)...
Cloud Init On...LXD
MAAS
What’s changing?LicenseLicense change from GPLv3 to dual license Apache 2.0 + GPLv3
Code Hosting / Development● hosted on stackforge using git● utilizes gerrit reviews● planned use of gerrits features for continuous integration● upstream git
● https://git.openstack.org/cgit/stackforge/cloud-init/ ● https://github.com/stackforge/cloud-init (mirror)
●Development lead by Canonical, Yahoo, and Cloudbase●Better documentation, test and continuous integration
and more!!
Cloud-init 2.0 supported platformsPythonsupport 2.6 (RHEL 6.x), 2.7 (Ubuntu 14.04), 3.4 (Ubuntu 15.04+)
Operating SystemsTargeting support for:
●RHEL: 6.x, 7.x●Ubuntu: 15.04+ (possibly supporting 14.04)●Windows Vista and newer●FreeBSD
Backwards CompatibilityWherever possible support user-data or cloud-config from 0.7.x
Post Boot Actions●Service / Agent available to process configs after boot●Events such as device hotplug or metadata change cause
actions●Query Datasource in cloud-agnostic manner
Lifecycle Events●Hooks called for events such as Startup, Shutdown,
Capture, Suspend, Resume. ● These hooks will/need to be defined in platform neutral way
(so that for example, Windows works as well).
Cloud-init 2.0 expected features
Cloud-init 2.0 expected features cont.
Disk and Network configuration specified in declarative data format. re-use of function built for maas and curtin.Networkingnetwork info sources provide cloud-init with data on how to configure network devices. Support static config, vlan, bonding ...Supports event driven configuration such as network adapter hotplug.
Block Device ConfigurationEnhance block device configuration of 0.7.X allowing for more complex disk usage. Support bcache, lvm, raid.
Tomato throwing time
Questions/comments??