Skip to content

Deploy an Instance for Testing Openstack

Juan Caviedes edited this page Apr 9, 2021 · 4 revisions

This section is intended to show how OpenStack functionality can be tested by deploying a single test instance based on the Ubuntu 18.04 LTS image. Consider all the steps outlined. The test was done with the following hardware requirements:

Feature Value
CPU 4
RAM 8 GiB
Disk 100 GB
OS Used Ubuntu 20.04 LTS

Previously, the VM where the test is done must have MicroStack installed like show the section Install MicroStack with Snap. The content of this page are:

Upload an Image Base to Openstack

Please consider that the exercise you want to carry out is to load an Ubuntu 18.04 LTS image and create an instance from this image. First, download the image in .QCOW2 format. At time of writing, the link to download this image is https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img.

Note: This download assumes that the processor architecture where MicroStack is installed is amd64, please choose the option that suits your environment.

cd /tmp/ && sudo apt udpate && sudo apt upgrade -y
wget https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img
# Upload the image to OpenStack
microstack.openstack image create --disk-format qcow2 --container-format bare --public --file /tmp/bionic-server-cloudimg-amd64.img Ubuntu18.04     # Wait until the command finish

You can verify the image uploading using the next command:

microstack.openstack image list
# +--------------------------------------+----------------------------------------------+--------+
# | ID                                   | Name                                         | Status |
# +--------------------------------------+----------------------------------------------+--------+
# | bbac76ac-8cef-463a-bf76-457570b4e6f6 | cirros                                       | active |
# | 7fefc80f-d745-4764-9389-00cc4a12585d | Ubuntu18.04                                  | active |
# +--------------------------------------+----------------------------------------------+--------+

Another Requeriments

By default, MicroStack have several flavors for creating images. You can validate the flavor list using the next commmand:

microstack.openstack flavor list
# +----+-----------+-------+------+-----------+-------+-----------+
# | ID | Name      |   RAM | Disk | Ephemeral | VCPUs | Is Public |
# +----+-----------+-------+------+-----------+-------+-----------+
# | 1  | m1.tiny   |   512 |    1 |         0 |     1 | True      |
# | 2  | m1.small  |  2048 |   20 |         0 |     1 | True      |
# | 3  | m1.medium |  4096 |   20 |         0 |     2 | True      |
# | 4  | m1.large  |  8192 |   20 |         0 |     4 | True      |
# | 5  | m1.xlarge | 16384 |   20 |         0 |     8 | True      |
# +----+-----------+-------+------+-----------+-------+-----------+

If you want to pass a keypair to instance, use the next command to list the availables keypairs:

microstack.openstack keypair list
# +------------+-------------------------------------------------+
# | Name       | Fingerprint                                     |
# +------------+-------------------------------------------------+
# | microstack | 98:f4:89:0b:5f:71:0d:24:3d:64:62:1b:1c:08:88:a4 |
# +------------+-------------------------------------------------+

It is important to list the availble networks for adding one to te new instance. Use the next command to list networks:

microstack.openstack network list
# +--------------------------------------+----------------------------------------------------+----------------------------------------------------------------------------+
# | ID                                   | Name                                               | Subnets                                                                    |
# +--------------------------------------+----------------------------------------------------+----------------------------------------------------------------------------+
# | 2bc176df-1a4b-4b37-9bc5-6504f206ac6e | mgmt                                               | 76cc1140-5710-411f-8d13-5bfb6700e6ab                                       |
# +--------------------------------------+----------------------------------------------------+----------------------------------------------------------------------------+

Finally, get the security group list. For this, execute the next command:

microstack.openstack security group list
# +--------------------------------------+-------------------+-----------------------------------+----------------------------------+
# | ID                                   | Name              | Description                       | Project                          |
# +--------------------------------------+-------------------+-----------------------------------+----------------------------------+
# | 011a398d-5c1b-41f4-a19d-4e920fe31ca8 | default           | Grupo de seguridad predeterminado | ce1788b19a5f48cda6792d10aa83361d |
# +--------------------------------------+-------------------+-----------------------------------+----------------------------------+

Create the Instance

Knowing before all the necessary information to create the instance, the generic command to create it is the following:

microstack.openstack server create --flavor FLAVOR_ID --image IMAGE_ID --user-data USER_DATA_FILE --security-group SEC_GROUP_NAME --property KEY=VALUE --net-id NET_ID INSTANCE_NAME

The next is an example for creating the instance using the before information:

miopenstack server create --flavor 3 --image 7fefc80f-d745-4764-9389-00cc4a12585d --security-group default --user-data ubuntu.init --net-id 2bc176df-1a4b-4b37-9bc5-6504f206ac6e Ubuntu-Server

To verify the creation of the server you can execute the next commands:

microstack.openstack server list
# +--------------------------------------+----------------+--------+--------------------------------------+----------+-----------+
# | ID                                   | Name           | Status | Networks                             | Image    | Flavor    |
# +--------------------------------------+----------------+--------+--------------------------------------+----------+-----------+
# | 88f931a4-f6c6-4669-b967-722569e1d393 | Ubuntu-Server  | ACTIVE | 10.80.81.172                         |          | m1.medium |
# +--------------------------------------+----------------+--------+--------------------------------------+----------+-----------+