OpenMCF logoOpenMCF

Loading...

OpenStack Instance

Deploys an OpenStack Compute instance with configurable flavor, image or boot-from-volume source, network attachments via network UUID or pre-provisioned port, and optional placement controls via server groups and availability zones.

What Gets Created

When you deploy an OpenStackInstance resource, OpenMCF provisions:

  • Compute Instance — an openstack_compute_instance_v2 resource with the specified flavor and image (or block device boot source), placed in the configured networks with attached security groups. When blockDevice entries are provided, the instance boots from persistent Cinder volumes instead of ephemeral image-based storage. When serverGroupId is set, scheduler hints control placement within the server group.

Prerequisites

  • OpenStack credentials configured via environment variables or OpenMCF provider config
  • At least one network (a network UUID or a pre-provisioned port UUID) for the instance to attach to
  • A flavor (by name or UUID) available in the target OpenStack project
  • A Glance image (by name or UUID) if not booting from a block device volume
  • An SSH keypair registered in OpenStack if setting keyPair
  • A server group if using placement constraints via serverGroupId

Quick Start

Create a file instance.yaml:

apiVersion: openstack.openmcf.org/v1
kind: OpenStackInstance
metadata:
  name: my-instance
  labels:
    openmcf.org/provisioner: pulumi
    pulumi.openmcf.org/organization: my-org
    pulumi.openmcf.org/project: my-project
    pulumi.openmcf.org/stack.name: dev.OpenStackInstance.my-instance
spec:
  flavorName: m1.medium
  imageName: ubuntu-22.04
  networks:
    - uuid: 4a0e3c5b-2f1d-4e6a-8b9c-0d1e2f3a4b5c

Deploy:

openmcf apply -f instance.yaml

This creates a compute instance with the m1.medium flavor, booted from the ubuntu-22.04 Glance image, attached to the specified network.

Configuration Reference

Required Fields

FieldTypeDescriptionValidation
flavorNamestringHuman-readable name of the instance flavor (e.g., m1.medium). Mutually exclusive with flavorId.Exactly one of flavorName or flavorId must be set
flavorIdstringUUID of the instance flavor. Mutually exclusive with flavorName.Exactly one of flavorName or flavorId must be set
networksInstanceNetwork[]Network attachments for the instance. Each entry connects the instance to a network via UUID or a pre-provisioned port.Minimum 1 item required
networks[].uuidStringValueOrRefNetwork UUID to attach to. OpenStack auto-creates a port on this network. Can reference an OpenStackNetwork resource via valueFrom. Mutually exclusive with port.Exactly one of uuid or port per network entry
networks[].portStringValueOrRefUUID of a pre-provisioned port to attach. Use for stable MAC/IP addresses or port-level security groups. Can reference an OpenStackNetworkPort resource via valueFrom. Mutually exclusive with uuid.Exactly one of uuid or port per network entry

Optional Fields

FieldTypeDefaultDescription
imageNamestring—Name of the Glance image to boot from (e.g., ubuntu-22.04). Optional when using blockDevice with a boot volume.
imageIdstring—UUID of the Glance image to boot from. Alternative to imageName. Optional when using blockDevice with a boot volume.
keyPairStringValueOrRef—SSH keypair name to inject into the instance. Can reference an OpenStackKeypair resource via valueFrom.
securityGroupsStringValueOrRef[]default SGSecurity group names to apply. Uses names, not UUIDs. Can reference OpenStackSecurityGroup resources via valueFrom. If omitted, OpenStack applies the default security group.
blockDeviceBlockDevice[][]Block device mappings for boot-from-volume or additional volumes at launch.
blockDevice[].sourceTypestring—Source type: blank, image, snapshot, or volume. Required per block device entry.
blockDevice[].uuidstring—UUID of the source image, volume, or snapshot. Required unless sourceType is blank.
blockDevice[].destinationTypestringlocalWhere the device is created: local (ephemeral) or volume (persistent Cinder volume).
blockDevice[].bootIndexint0Boot order: 0 = boot device, -1 = not bootable, higher values = lower priority.
blockDevice[].volumeSizeint—Size in GB. Required for image-to-volume and blank mappings.
blockDevice[].deleteOnTerminationboolfalseWhen true, the volume is deleted when the instance terminates.
blockDevice[].volumeTypestring—Cinder volume type (e.g., SSD, HDD). Only applies when destinationType is volume.
networks[].fixedIpV4string—Specific IPv4 address to request on the network. Only applies when uuid is used, not port.
networks[].accessNetworkboolfalseMarks this network as the access network, determining which IP appears in the access_ip_v4 output.
userDatastring—Cloud-init configuration or script for first boot. Base64-encoded before passing to the instance. ForceNew: changing this recreates the instance.
metadatamap<string, string>{}Key-value pairs attached to the instance, visible in the OpenStack API. Can be updated without recreating the instance.
configDrivebool—Enables a config drive containing instance metadata and user data on a local read-only disk. ForceNew: changing this recreates the instance.
serverGroupIdStringValueOrRef—Server group UUID for placement control. Maps to scheduler hints. Can reference an OpenStackServerGroup resource via valueFrom. ForceNew.
availabilityZonestring—AZ where the instance launches (e.g., nova, az1). If omitted, Nova selects one. ForceNew.
tagsstring[][]Tags for filtering and organization in the OpenStack API. Must be unique.
regionstringprovider defaultOverrides the region from the provider config for this instance.

Examples

Basic Instance with Image Boot

A minimal instance booted from a Glance image on a single network with an SSH keypair:

apiVersion: openstack.openmcf.org/v1
kind: OpenStackInstance
metadata:
  name: web-server
  labels:
    openmcf.org/provisioner: pulumi
    pulumi.openmcf.org/organization: my-org
    pulumi.openmcf.org/project: my-project
    pulumi.openmcf.org/stack.name: dev.OpenStackInstance.web-server
spec:
  flavorName: m1.small
  imageName: ubuntu-22.04
  keyPair: my-keypair
  networks:
    - uuid: 4a0e3c5b-2f1d-4e6a-8b9c-0d1e2f3a4b5c
  securityGroups:
    - web-sg

Boot from Volume

An instance with a persistent 50 GB root disk created from a Glance image, recommended for production workloads where the root disk must survive instance rebuilds:

apiVersion: openstack.openmcf.org/v1
kind: OpenStackInstance
metadata:
  name: db-server
  labels:
    openmcf.org/provisioner: pulumi
    pulumi.openmcf.org/organization: my-org
    pulumi.openmcf.org/project: my-project
    pulumi.openmcf.org/stack.name: prod.OpenStackInstance.db-server
spec:
  flavorName: m1.large
  keyPair: ops-keypair
  networks:
    - uuid: 4a0e3c5b-2f1d-4e6a-8b9c-0d1e2f3a4b5c
  securityGroups:
    - db-sg
  blockDevice:
    - sourceType: image
      uuid: 12345678-abcd-efgh-ijkl-123456789abc
      destinationType: volume
      bootIndex: 0
      volumeSize: 50
      deleteOnTermination: false
      volumeType: SSD

Full-Featured Instance with Placement Controls

Production instance with server group placement, cloud-init configuration, metadata, multiple networks, and a specific availability zone:

apiVersion: openstack.openmcf.org/v1
kind: OpenStackInstance
metadata:
  name: app-server-01
  labels:
    openmcf.org/provisioner: pulumi
    pulumi.openmcf.org/organization: my-org
    pulumi.openmcf.org/project: my-project
    pulumi.openmcf.org/stack.name: prod.OpenStackInstance.app-server-01
spec:
  flavorName: m1.xlarge
  imageName: ubuntu-22.04
  keyPair: prod-keypair
  availabilityZone: az1
  configDrive: true
  serverGroupId: 98765432-dcba-4321-fedc-ba9876543210
  networks:
    - uuid: 4a0e3c5b-2f1d-4e6a-8b9c-0d1e2f3a4b5c
      accessNetwork: true
    - uuid: 7d8e9f0a-1b2c-3d4e-5f6a-7b8c9d0e1f2a
  securityGroups:
    - app-sg
    - monitoring-sg
  userData: |
    #cloud-config
    packages:
      - nginx
      - prometheus-node-exporter
    runcmd:
      - systemctl enable nginx
      - systemctl start nginx
  metadata:
    environment: production
    team: platform
  tags:
    - production
    - app-tier

Using Foreign Key References

Reference other OpenMCF-managed resources instead of hardcoding UUIDs:

apiVersion: openstack.openmcf.org/v1
kind: OpenStackInstance
metadata:
  name: ref-instance
  labels:
    openmcf.org/provisioner: pulumi
    pulumi.openmcf.org/organization: my-org
    pulumi.openmcf.org/project: my-project
    pulumi.openmcf.org/stack.name: prod.OpenStackInstance.ref-instance
spec:
  flavorName: m1.medium
  imageName: ubuntu-22.04
  keyPair:
    valueFrom:
      kind: OpenStackKeypair
      name: my-keypair
      field: status.outputs.name
  networks:
    - uuid:
        valueFrom:
          kind: OpenStackNetwork
          name: my-network
          field: status.outputs.network_id
  securityGroups:
    - valueFrom:
        kind: OpenStackSecurityGroup
        name: app-sg
        field: status.outputs.name
  serverGroupId:
    valueFrom:
      kind: OpenStackServerGroup
      name: anti-affinity-group
      field: status.outputs.server_group_id

Stack Outputs

After deployment, the following outputs are available in status.outputs:

OutputTypeDescription
instance_idstringUUID of the created compute instance
namestringName of the instance, derived from metadata.name
access_ip_v4stringBest IPv4 address for accessing the instance, prioritizing the access network if one is marked
access_ip_v6stringBest IPv6 address for accessing the instance. Empty if the instance has no IPv6 connectivity.
regionstringOpenStack region where the instance was created

Related Components

  • OpenStackNetwork — provides the network for instance attachment
  • OpenStackNetworkPort — provides pre-provisioned ports for stable network identity
  • OpenStackKeypair — manages the SSH keypair injected into the instance
  • OpenStackSecurityGroup — controls inbound and outbound traffic rules
  • OpenStackServerGroup — defines placement policies (affinity/anti-affinity) for instance groups

Next article

OpenStack Keypair

OpenStack Keypair Deploys an OpenStack Nova compute keypair for SSH authentication to instances. Supports both importing an existing public key and having OpenStack generate a new keypair. What Gets Created When you deploy an OpenStackKeypair resource, OpenMCF provisions: Compute Keypair — an openstackcomputekeypairv2 resource that registers an SSH public key with Nova for injection into instances at launch time via cloud-init When no publicKey is provided in the spec, OpenStack generates a new...
Read next article
Presets
2 ready-to-deploy configurationsView presets →