Containers and Heat and Health Maintenance
Mike Spreitzer IBM Research
The Take-‐Away • You can use Docker through Nova • Heat provides desired-‐state based management
• OpenStack can do health maintenance today
Docker and Nova • There is a “Docker driver” for Nova • Allows you to create/manage Docker containers through the normal API for VMs
• Special images
Heat • A “template” is a model: desired state – Has inputs (“parameters”) and outputs – Has resources
• Most correspond to an object in an OpenStack API • Some are synthePc things
– E.g., autoscaling group • Each has inputs (“properPes”) and outputs (“aTributes”)
• A “stack” is an instance of a template – Yes, recursion allowed
• Heat allows CRUD of stacks from templates
The Picture of Health
OS::Neutron::LoadBalancer
OS::Neutron::Pool
OS::Nova::Server
OS::Heat::HARestarter
OS::Neutron::PoolMember
OS::Ceilometer::Alarm OS::Neutron::HealthMonitor
Template for a Container with Health Maintenance, p1
heat_template_version: 2013-05-23!description: A container subject to health maintenance!parameters:! image:! type: string! description: Image used for containers! flavor:! type: string! description: flavor used by the containers! default: m1.tiny!
Template for a Container with Health Maintenance, p2
private_network:! type: string! description:! Name or ID of the network to which! the container will be attached! protocol_port:! type: number! description: port number where container listens! default: 80! pool_id:! type: string! description: LB Pool of which to be a member!
Template for a Container with Health Maintenance, p3
resources:! server:! type: OS::Nova::Server! properties:! flavor: {get_param: flavor}! image: {get_param: image}! networks:! - {network: {get_param: private_network}}! ! restarter:! type: OS::Heat::HARestarter! properties:! InstanceId: {get_resource: server}!
Template for a Container with Health Maintenance, p4
member:! type: OS::Neutron::PoolMember! properties:! pool_id: {get_param: pool_id}! address: {get_attr: [server, first_address]}! protocol_port: {get_param: protocol_port}!
Template for a Container with Health Maintenance, p5 (old version)
gone_alarm:! type: OS::Ceilometer::Alarm! properties:! description: Detect container being unresponsive! meter_name: network.services.lb.member! statistic: avg! period: 70! evaluation_periods: 2! threshold: 1! alarm_actions: [ {get_attr:! [restarter, AlarmUrl]} ]! matching_metadata: {resource:! {get_resource: member} }! comparison_operator: lt!
Template for a Container with Health Maintenance, p5 (new version)
gone_alarm:! type: OS::Ceilometer::Alarm! properties:! description: Detect container being unresponsive! meter_name: network.services.lb.member! statistic: avg! period: 70! evaluation_periods: 2! threshold: 1! alarm_actions: [ {get_attr:! [restarter, AlarmUrl]} ]! query: {field: resource_id, op: eq,! value: {get_resource: member} }! comparison_operator: lt!
Template for a Container with Health Maintenance, p6
outputs:! ceilometer_query:! value:! str_replace:! template:! ceilometer statistics! -m network.services.lb.member! -q resource_id=memberid -p 70 -a avg! params:! memberid: {get_resource: member}! description:! This is a Ceilometer CLI command that produces! stats similar to those used by the alarm!
Template for a Container with Health Maintenance, p7
restart_url:! value: {get_attr: [restarter, AlarmUrl]}! description: the webhook for the HARestarter! !
Also Talk to Me About • PaaS and IaaS for Containers • Balancing an ASG across AZs • HolisPc placement in OpenStack