OPCP - How to Deploy an Instance via OpenStack APIs
Objective
This guide details the steps to install an OPCP node by creating an instance through the OpenStack APIs. Before deploying services on your OPCP clusters, you must have at least one installed and active node.
Requirements
- Have an active OPCP service.
- Have a user account with sufficient rights to access the OpenStack APIs.
- Prepare the environment to use the OpenStack API.
- Load the environment variables for the project.
Instructions
You can obtain a list of available OpenStack commands using the following command:
You can filter the displayed commands by specifying a group:
You can also get information about a specific command by adding help before it:
Check the OpenStack client documentation directly on the OpenStack website.
Retrieve the Parameters Needed to Create an Instance
Create a Private Network and a Subnet
Step 1: Create the Private Network
Before deploying your instance, it is generally necessary to create a private network so that it is accessible within your local infrastructure. If you already have a network with a subnet in your project that you want to use, you can skip this creation step and directly list your networks to get the name or ID of the desired network.
By default, a network is visible only to the project that created it (as well as to administrator users).
If you want to create a network shared across all your projects, you can use the --share parameter.
To share a network only with specific projects, you must use OpenStack's Role-Based Access Control (RBAC) mechanism: Neutron RBAC Documentation.
Additionally, if you want to create the network in a specific VLAN, you can specify it with the following parameters:
--provider-network-type vlan--provider-physical-network physnet1--provider-segment $VLAN_ID
For example, if you want to create a shared private network in VLAN 2025 named opcpdocs:
Once the network is created, you can list it using the command:
If needed, you can list all networks by removing the --name argument.
Step 2: Create the Subnet
By default, the only required information to create a subnet on your network is the CIDR you want to configure and the network you just created:
However, if you want to specify an allocation pool, you can define it using various parameters.
For example, to create a subnet with CIDR 192.168.120.0/24, allocating only 50 IP addresses from the CIDR, and using a specific gateway, you can use the following command:
This subnet can be used to deploy an instance, allowing OpenStack to assign an IP address to it during installation.
Adding a Public SSH Key
First, you need to add a public SSH key to connect to your instances.
- List the SSH key-related commands:
- Add the public SSH key:
- List available SSH keys:
List Instance Flavors
Next, retrieve the ID or name of the flavor you want to use:
List Available Images
Finally, get the ID or name of the image to use for the instance:
Instance Installation
With the previously gathered information, you can create an instance to deploy an operating system along with your SSH public key on the desired flavor:
By default, the instance to be installed is automatically selected from the pool of nodes in Available status, for which the required traits of the flavor match the requested installation. This means a physical server meeting the constraints described by the traits will be selected.
After a few minutes, the instance is deployed, and you can list your installed instances using the following command:
If you want to install the instance on a specific node, you can specify the node ID in your command:
You must ensure that the node is Available and has the required traits to deploy the desired flavor.
To check the current state of a node and retrieve its ID, you can consult our documentation: OPCP Node Lifecycle.
Deleting an Instance
You can delete an instance with the following command:
Your node will go into Cleaning state. This step involves a hardware reset of the physical server and erasure of the data on its disks.
During this step, the instance will no longer appear in the instance list; however, the node will not be immediately available for a new installation. Please consider this delay during your maintenance operations.
The operation may take several minutes before the node is Available again and ready for a new deployment.
References
Go further
If you need training or technical assistance for the implementation of our solutions, contact your sales representative or click this link to request a quote and have your project analyzed by our Professional Services team experts.
Join our community of users.