Skip to content
VirtualLP Virtual Learning Platform

OpenStack in Production and Orchestration with Heat

16 min read Topic 22 of 34 1 hands-on lab

A cloud used for real work must handle failures, updates and many users. This is called a production environment. It needs more planning than a practice setup.

Heat helps create connected resources from one template. A template is a file that describes what you want. Heat uses it to create networks, servers and storage in the required order.

recipe

Building servers by clicking is like cooking without a recipe – every time it comes out a bit different, and you forget steps. A Heat template is a written recipe: anyone can follow it and get the same dish every time, and you can improve the recipe and keep old versions.

Building a production environment

1. High availability (HA)

High availability means no single failure should stop the cloud.

Layer How HA is achieved
Controllers Three or more controller nodes behind a load balancer (HAProxy + Keepalived give one shared virtual IP (Internet Protocol)). The API (Application Programming Interface) services don't keep state, so all controllers work at the same time (active/active).
Database MariaDB Galera cluster – every node can write and they stay in sync; at least 3 nodes
Message queue RabbitMQ cluster with quorum queues
Networking Distributed Virtual Routing (DVR) or L3 HA (routers backed up with VRRP (Virtual Router Redundancy Protocol)); OVN (Open Virtual Network) with distributed gateways
Storage Ceph keeping 3 copies of data (or erasure coding) – no single point of failure
Compute Instance HA (Masakari) restarts VMs (Virtual Machines) from a failed host elsewhere; live migration empties a host for maintenance
Data centre Several availability zones and regions
Why three controllers?

Clustered databases and queues need a quorum (a majority vote) to avoid split brain – two halves both thinking they are in charge. With 3 nodes, the cluster survives losing 1 (2 out of 3 is still a majority). With 2 nodes, if they lose contact, neither half has a majority, so it cannot decide.

2. Capacity planning

  • Estimate how many VMs, how much vCPU/RAM (Random Access Memory) per VM and how fast storage will grow.
  • Choose overcommit ratios – for example cpu_allocation_ratio = 4.0 means 4 virtual CPUs (Central Processing Units) per physical core (VMs rarely use 100 % CPU all the time); ram_allocation_ratio = 1.0–1.5 (RAM is overcommitted carefully).
  • Plan network speed (25/100 GbE), IP address ranges and floating IP pools.
  • Keep spare capacity (N+1) so one host can fail or be taken down for maintenance.

3. Automated, repeatable deployment

Tool Approach
Kolla-Ansible Every service runs in a Docker container, set up by Ansible – very popular
OpenStack-Ansible Ansible playbooks; services in LXC containers or directly on hosts
Charmed OpenStack / Sunbeam Canonical's Juju charms / snap-based install
Red Hat OpenStack Services on OpenShift (RHOSO) The control plane runs on Kubernetes operators
Kayobe Prepares bare-metal servers + Kolla-Ansible

All settings is kept in Git (infrastructure as code), so an environment can be rebuilt exactly the same any time.

4. Operations (day-to-day running)

  • Monitoring and alerting – Prometheus + Grafana, Nagios/Zabbix: is every service healthy, how full are the hypervisors?
  • Central logging – OpenSearch/ELK, Fluentd: all logs in one searchable place.
  • Metering and billing – Ceilometer + Gnocchi measure usage, CloudKitty turns it into bills.
  • Backups – database dumps, settings backups, volume backups (cinder-backup), image backups.
  • Upgrades – OpenStack supports rolling upgrades (one node at a time); SLURP releases let you skip one release (for example 2024.1 → 2025.1).
  • Security hardening – TLS (Transport Layer Security) (HTTPS (Hypertext Transfer Protocol Secure)) on all endpoints, Keystone connected to LDAP/SSO (Single Sign-On), separated networks, SELinux/AppArmor, regular patching, audit logs (CADF (Cloud Auditing Data Federation) format).
  • Capacity management & quotas, procedures for adding new users, and documentation.

Using OpenStack in production – common patterns

Pattern Example
Private IaaS (Infrastructure as a Service) for internal teams Developers create VMs themselves instead of raising tickets and waiting
Telco cloud / NFV (Network Functions Virtualization) 5G core network functions run on OpenStack (most large telecom companies)
Research computing CERN runs hundreds of thousands of CPU cores on OpenStack
Public cloud OVHcloud, Open Telekom Cloud, Indian and regional providers
Edge clouds Small OpenStack sites near users (StarlingX)

Application orchestration with Heat

Orchestration

Orchestration creates and manages connected resources together. It handles the order of tasks, such as creating a network before starting the server that needs it.

OpenStack Heat

Heat is OpenStack's orchestration service. It reads a template file and creates the resources described in it. The group of resources is called a stack. Heat can also update or delete that stack.

Heat architecture

Component Role
heat-api Heat's own REST (Representational State Transfer) API (for HOT templates)
heat-api-cfn An API compatible with AWS (Amazon Web Services) CloudFormation
heat-engine Reads templates, works out which resource depends on which, calls the Nova/Neutron/Cinder APIs, keeps track of the stack's state
Template A YAML (YAML Ain't Markup Language) file in HOT (Heat Orchestration Template) format
Stack All the resources created from one template, managed together
flowchart LR
    T[HOT template<br/>YAML] --> API[heat-api] --> E[heat-engine]
    E -->|creates| NW[Neutron:<br/>net, subnet, router, SG]
    E -->|creates| SV[Nova:<br/>servers]
    E -->|creates| VL[Cinder:<br/>volumes]
    E -->|creates| LB[Octavia:<br/>load balancer]
    E --> ST[(Stack state)]

Structure of a HOT template

Section Purpose
heat_template_version Which version of the HOT format (for example 2021-04-16 or wallaby) – required
description A short human description
parameters Inputs you give when launching (image, flavor, key), with types, defaults and allowed values
parameter_groups Groups parameters for forms in the UI (User Interface)
resources The OpenStack resources to create – required
outputs Results shown after creation (IP address, website URL (Uniform Resource Locator))
conditions Create some resources only if a condition is true

Intrinsic functions (built-in helpers) connect the pieces:

  • get_param – use an input value,
  • get_resource – refer to another resource in the same template,
  • get_attr – read an attribute of a resource after it is created (for example its IP),
  • str_replace, list_join – build text,
  • get_file – include a file,
  • if – choose a value based on a condition.

Example: a web server stack

heat_template_version: 2021-04-16
description: Single web server with its own network, security group and floating IP

parameters:
  image:
    type: string
    default: ubuntu-24.04
    description: Image to boot
  flavor:
    type: string
    default: m1.small
    constraints:
      - allowed_values: [m1.tiny, m1.small, m1.medium]
  key_name:
    type: string
    description: Existing key pair
  public_net:
    type: string
    default: public

resources:
  web_net:
    type: OS::Neutron::Net
    properties: { name: web-net }

  web_subnet:
    type: OS::Neutron::Subnet
    properties:
      network: { get_resource: web_net }
      cidr: 10.20.0.0/24
      dns_nameservers: [8.8.8.8]

  router:
    type: OS::Neutron::Router
    properties:
      external_gateway_info: { network: { get_param: public_net } }

  router_iface:
    type: OS::Neutron::RouterInterface
    properties:
      router: { get_resource: router }
      subnet: { get_resource: web_subnet }

  web_sg:
    type: OS::Neutron::SecurityGroup
    properties:
      rules:
        - { protocol: tcp, port_range_min: 22, port_range_max: 22 }
        - { protocol: tcp, port_range_min: 80, port_range_max: 80 }
        - { protocol: icmp }

  web_server:
    type: OS::Nova::Server
    properties:
      name: web-01
      image: { get_param: image }
      flavor: { get_param: flavor }
      key_name: { get_param: key_name }
      networks: [{ network: { get_resource: web_net } }]
      security_groups: [{ get_resource: web_sg }]
      user_data_format: RAW
      user_data: |
        #!/bin/bash
        apt-get update && apt-get install -y nginx
        echo "<h1>Deployed by OpenStack Heat</h1>" > /var/www/html/index.html

  web_fip:
    type: OS::Neutron::FloatingIP
    depends_on: router_iface
    properties:
      floating_network: { get_param: public_net }

  web_fip_assoc:
    type: OS::Neutron::FloatingIPAssociation
    properties:
      floatingip_id: { get_resource: web_fip }
      port_id: { get_attr: [web_server, addresses, web-net, 0, port] }

outputs:
  website_url:
    description: URL of the web server
    value:
      str_replace:
        template: http://HOST/
        params: { HOST: { get_attr: [web_fip, floating_ip_address] } }

What this template creates:

  1. Inputs: the image, the flavor (only tiny/small/medium allowed), your key pair, and the public network name.
  2. A private network web-net and a subnet 10.20.0.0/24.
  3. A router connected to the public network, and an interface joining it to the subnet.
  4. A security group that opens SSH (Secure Shell) (22), HTTP (Hypertext Transfer Protocol) (80) and ping.
  5. A server web-01 that, at first boot, installs nginx and writes a welcome page (user_data).
  6. A floating (public) IP, attached to the server.
  7. Output: the website URL, built from the floating IP.

Heat follows the links between resources. It creates a network before its subnet and creates the server before attaching its floating IP. It can create independent resources at the same time.

Working with stacks

pip install python-heatclient
openstack stack create -t web.yaml --parameter key_name=mykey web-stack
openstack stack list
openstack stack event list web-stack          # CREATE_IN_PROGRESS → CREATE_COMPLETE
openstack stack resource list web-stack
openstack stack output show web-stack website_url
openstack stack update -t web.yaml --parameter flavor=m1.medium web-stack   # change in place
openstack stack delete web-stack              # removes ALL resources

The commands create a stack from web.yaml, show its events and resources, and display its website URL. They then update the VM size and delete the stack. Check the stack state after each action.

Stack states: CREATE_IN_PROGRESS, CREATE_COMPLETE, CREATE_FAILED, UPDATE_*, DELETE_*, ROLLBACK_*. In Horizon: Project → Orchestration → Stacks → Launch Stack.

Auto-scaling with Heat

  web_group:
    type: OS::Heat::AutoScalingGroup
    properties:
      min_size: 2
      max_size: 6
      resource:
        type: OS::Nova::Server
        properties: { image: ubuntu-24.04, flavor: m1.small, networks: [{ network: web-net }] }

  scale_out:
    type: OS::Heat::ScalingPolicy
    properties:
      auto_scaling_group_id: { get_resource: web_group }
      adjustment_type: change_in_capacity
      scaling_adjustment: 1
      cooldown: 120

The group keeps 2–6 web servers. The scale_out policy adds one server, then waits 120 seconds before another scaling action. An Aodh alarm can call the policy when CPU use is high.

Benefits of orchestration

  • Repeatable – the same template builds identical dev, test and production environments.
  • Version-controlled – templates live in Git, so changes are tracked.
  • Dependencies handled automatically – no need to remember the order.
  • One unit – update or delete everything together; nothing is forgotten and left running.
  • Self-documenting – the template is the description of your architecture.
In the real world

Many teams use Terraform with the OpenStack provider for multi-cloud infrastructure as code, but Heat is built into OpenStack, needs no extra tools, and is used inside OpenStack services such as Magnum (Kubernetes clusters) and Sahara.

Virtual lab · OpenStack · 25 min

Orchestrate a complete web stack with OpenStack Heat

Deploy network, subnet, router, security group, server and floating IP from one HOT template, inspect resources, events and outputs, then remove everything by deleting the stack.

Open lab

Summary

  • Production OpenStack needs HA (at least 3 controllers, Galera, RabbitMQ cluster, HAProxy/Keepalived, Ceph), capacity planning with overcommit ratios, automated deployment (Kolla-Ansible etc.), monitoring, logging, backups, rolling upgrades and hardening.
  • Heat is OpenStack's orchestration service; HOT templates contain version, description, parameters, resources and outputs.
  • Intrinsic functions (get_param, get_resource, get_attr) link resources; Heat works out dependencies automatically.
  • Stacks are created, updated and deleted as one unit; OS::Heat::AutoScalingGroup + scaling policies give auto-scaling.

Practice questions

  1. What are the considerations for deploying OpenStack in a production environment?
  2. How is high availability achieved for OpenStack controllers, database and storage?
  3. What is orchestration? Explain OpenStack Heat and its components.
  4. Explain the structure of a HOT template with an example.
  5. Write a Heat template that creates a network, security group and server.
  6. List the CLI (Command-Line Interface) commands to create, inspect, update and delete a Heat stack.
  7. Compare Heat and AWS CloudFormation.

Practise this topic

Hands-on virtual lab

Apply what you just read in a realistic, guided simulation. Free with a verified account.

Create a free account to track your progress and unlock virtual labs.