26
Openstack Heat Arun prasath S Dec 23, 2014

Openstack Heat

Embed Size (px)

Citation preview

Page 1: Openstack Heat

Openstack Heat

Arun prasath SDec 23, 2014

Page 2: Openstack Heat

What is Heat ?

Template-driven engine

that allows us to describe and

automate the deployment of

infrastructure

Page 3: Openstack Heat

Use cases

• Infrastructure provisioning using templates

• Version controlling the infrastructure

• Auto scale feature

• Works well with configuration management tools

• Many PaaS applications

Page 4: Openstack Heat

Orchestration in other platforms

• AWS – CloudFormation

• CloudStack templates

• Azure PowerShell cmdlets

• Eucalyptus - CloudFormation

Page 5: Openstack Heat

Heat capabilities

• Provides ability to describe an infrastructure in text file.

• Infrastructure resources include – Servers, network,

router, floating IP, security groups

• We can also specify the relationship between the

resources

• Changes in infrastructure made easy

Page 6: Openstack Heat

Heat Overview

Page 7: Openstack Heat

Architecture• Heat project comprises of number of

python applicationso heat

o heat-api

o heat-api-cfn

o heat-engine

Page 8: Openstack Heat

Architecture

Page 9: Openstack Heat

Workflow

Page 10: Openstack Heat

Implementation

• Create database for Heat

• Create Keystone users and roles

• Create services and endpoints

• Install necessary packages

Page 11: Openstack Heat

Heat components

Stack

Resource

Resource

Network subnet

Router

Subnet – Router connection

Some other resources

Nested stack

Page 12: Openstack Heat

HOT AnatomyParameters

User defined parameters passed into template from CLI or GUI

Parameters include type, description, default value, hidden, and constraints

Resources

Resources for Heat to Orchestrate

Consists of Type, Properties, DependsOn

Resources produce global attributes

Outputs

Displayed via CLI/GUI to identify important information of template

Page 13: Openstack Heat

HOT Anatomy -Parameters

heat_template_version: 2013-05-23

parameters:

image:

type: string

description: Image to use for the instance to be created.

default: cirros0.3.2x86_64disk

constraints:

- allowed_values: ['cirros0.3.2x86_64disk','fedora20.x86_64']

volume_size:

type: number

description: Size of volume to attach to instance

default: 1

constraints:

- range: {min: 1, max: 10}

Page 14: Openstack Heat

HOT Anatomy -Resources

heat_template_version: 2013-05-23

resources:

heat_network_01:

type: OS::Neutron::Net

properties:

admin_state_up: true

name: heat-network-01

heat_subnet_01:

type: OS::Neutron::Subnet

properties:

name: heat-subnet-01

cidr: 10.10.10.0/24

enable_dhcp: true

network_id: { get_resource: heat_network_01 }

Page 15: Openstack Heat

HOT Anatomy - Outputoutputs:

instance_ip:

description: The IP address of the deployed Web application

value: { get_attr: [web-app-instance, show] }

Connection_details:

description: The IP address of the deployed Web application

value: { get_attr: [web-app-instance, addresses, public, 0] }

Page 16: Openstack Heat

Hello Heatheat_template_version: 2013-05-23

resources:

compute_instance: # You can name this whatever you

prefer

type: "OS::Nova::Server"

properties:

flavor: 1GB Standard Instance

image: CentOS 6.5

name: My Compute Instance

Page 17: Openstack Heat

Ways to run heat command

• By using python-heatclient

• By using Horizon

Input template

File

Direct text

URL

Page 18: Openstack Heat

Nested stack example(my_nested.yaml)

heat_template_version: 2013-05-23

resources:

my_instance:

type: OS::Nova::Server

properties:

flavor: m1.small

image: my_image

(new_stack.yaml)

heat_template_version: 2013-05-23

resources:

my_nested:

type: my_nested.yaml

Page 19: Openstack Heat

Provider resourcesNo hard-coded names/paths (in the template)

Staging workflow/testing much simplified

Allows deployer or user to define custom resource types

– /etc/heat/environment.d

– /etc/heat/templates

– Users heat stack-create –environment-file=foo.yaml

-Users can override default environment resources!

resource_registry:

"My::Custom::Server": server.yaml

Page 20: Openstack Heat

Environmentsparameters:

key_name: mykey

resource_registry:

My::Custom::Server : my_server.yaml

OS::Nova::Server : override_nova.yaml

• python-heatclient resolves local files and URLs

• Files associated with environment are passed along with the stack-create/update API request

• heat stack-create mystack -f template.yaml –e environment.yaml

Page 21: Openstack Heat

Provider Resource Example

(my_nested.yaml)

heat_template_version: 20130523

resources:

my_instance:

type: OS::Nova::Server

properties:

flavor: m1.small

image: my_image

(my_stack.yaml)

heat_template_version: 20130523

resources:

my_nested:

type: My::Custom::Server

(environment.yaml)

resource_registry:

My::Custom::Server: my_nested.yaml

Page 22: Openstack Heat

Demo : Create an instance

Page 23: Openstack Heat

Demo : Deploy a web server using HEAT

Page 24: Openstack Heat

Troubleshooting

• Check if you can reach the endpoints

• heat template-validate

• heat template-show

• Check for resources

• Logs - /var/log/heat/*

Page 25: Openstack Heat

Important links• http://docs.openstack.org/developer/heat/template_guide

/hot_guide.html

• http://docs.openstack.org/developer/heat/template_guide

/

• https://github.com/openstack/heat-templates

Page 26: Openstack Heat

Questions ?