Ubuntu 24.04
Sponsored Link

OpenStack Dalmatian : Create Instances2024/10/04

 

Create and Start Virtual Machine Instances.

[1] Login as a user that you set environment variables for Openstack and then create and start virtual machine instance.
# confirm available [flavor] list

ubuntu@dlp ~(keystone)$
openstack flavor list

+----+-----------+-------+------+-----------+-------+-----------+
| ID | Name      |   RAM | Disk | Ephemeral | VCPUs | Is Public |
+----+-----------+-------+------+-----------+-------+-----------+
| 1  | m1.tiny   |  2048 |   10 |         0 |     1 | True      |
| 2  | m1.small  |  4096 |   10 |         0 |     2 | True      |
| 3  | m1.medium |  8192 |   10 |         0 |     4 | True      |
| 4  | m1.large  | 16384 |   10 |         0 |     8 | True      |
| 5  | m2.medium |  8192 |   10 |        10 |     4 | True      |
+----+-----------+-------+------+-----------+-------+-----------+

# confirm available image list

ubuntu@dlp ~(keystone)$
openstack image list

+--------------------------------------+------------+--------+
| ID                                   | Name       | Status |
+--------------------------------------+------------+--------+
| a9d10f1d-d836-424d-8117-ff3fc8c5e966 | Ubuntu2404 | active |
+--------------------------------------+------------+--------+

# confirm available network list

ubuntu@dlp ~(keystone)$
openstack network list

+--------------------------------+------------+--------------------------------+
| ID                             | Name       | Subnets                        |
+--------------------------------+------------+--------------------------------+
| 7398c285-1333-4aa7-a487-       | sharednet1 | 7097c0b5-34be-4179-8316-       |
| 1d37e5e27eb9                   |            | 7b9131d61308                   |
+--------------------------------+------------+--------------------------------+

# create a security group for instances

ubuntu@dlp ~(keystone)$
openstack security group create secgroup01

+-----------------+------------------------------------------------------------+
| Field           | Value                                                      |
+-----------------+------------------------------------------------------------+
| created_at      | 2024-10-04T01:57:20Z                                       |
| description     | secgroup01                                                 |
| id              | f1f9a564-53aa-4c02-b302-d89928deef8b                       |
| name            | secgroup01                                                 |
| project_id      | 84e315c8d65e4b3cb33aaf69c9eed0c3                           |
| revision_number | 1                                                          |
| rules           | created_at='2024-10-04T01:57:20Z', direction='egress',     |
|                 | ethertype='IPv4',                                          |
|                 | id='5934759e-8a12-41ce-8022-1828cfe11edc',                 |
|                 | standard_attr_id='20', updated_at='2024-10-04T01:57:20Z'   |
|                 | created_at='2024-10-04T01:57:20Z', direction='egress',     |
|                 | ethertype='IPv6',                                          |
|                 | id='c93b5106-6f45-4bd7-8ffd-7b74d7408f65',                 |
|                 | standard_attr_id='21', updated_at='2024-10-04T01:57:20Z'   |
| shared          | False                                                      |
| stateful        | True                                                       |
| tags            | []                                                         |
| updated_at      | 2024-10-04T01:57:20Z                                       |
+-----------------+------------------------------------------------------------+

ubuntu@dlp ~(keystone)$
openstack security group list

+------------------+------------+------------------+--------------------+------+
| ID               | Name       | Description      | Project            | Tags |
+------------------+------------+------------------+--------------------+------+
| e7031ca4-f693-   | default    | Default security | 84e315c8d65e4b3cb3 | []   |
| 4184-87f8-       |            | group            | 3aaf69c9eed0c3     |      |
| 9099b24faef7     |            |                  |                    |      |
| f1f9a564-53aa-   | secgroup01 | secgroup01       | 84e315c8d65e4b3cb3 | []   |
| 4c02-b302-       |            |                  | 3aaf69c9eed0c3     |      |
| d89928deef8b     |            |                  |                    |      |
+------------------+------------+------------------+--------------------+------+

# create an SSH keypair for connecting to instances

ubuntu@dlp ~(keystone)$
ssh-keygen -q -N ""

Enter file in which to save the key (/home/ubuntu/.ssh/id_ed25519):
# add public-key

ubuntu@dlp ~(keystone)$
openstack keypair create --public-key ~/.ssh/id_ed25519.pub mykey

+-------------+-------------------------------------------------+
| Field       | Value                                           |
+-------------+-------------------------------------------------+
| created_at  | None                                            |
| fingerprint | ca:3f:20:19:6b:52:fc:c8:78:9e:d9:99:fe:1b:b5:0d |
| id          | mykey                                           |
| is_deleted  | None                                            |
| name        | mykey                                           |
| type        | ssh                                             |
| user_id     | d97d1aef1b234c469ad3757bcd51dfa4                |
+-------------+-------------------------------------------------+

ubuntu@dlp ~(keystone)$
openstack keypair list

+-------+-------------------------------------------------+------+
| Name  | Fingerprint                                     | Type |
+-------+-------------------------------------------------+------+
| mykey | ca:3f:20:19:6b:52:fc:c8:78:9e:d9:99:fe:1b:b5:0d | ssh  |
+-------+-------------------------------------------------+------+

ubuntu@dlp ~(keystone)$
netID=$(openstack network list | grep sharednet1 | awk '{ print $2 }')

# create and start instance

ubuntu@dlp ~(keystone)$
openstack server create --flavor m1.small --image Ubuntu2404 --security-group secgroup01 --nic net-id=$netID --key-name mykey Ubuntu-2404
+-------------------------------------+----------------------------------------+
| Field                               | Value                                  |
+-------------------------------------+----------------------------------------+
| OS-DCF:diskConfig                   | MANUAL                                 |
| OS-EXT-AZ:availability_zone         | None                                   |
| OS-EXT-SRV-ATTR:host                | None                                   |
| OS-EXT-SRV-ATTR:hostname            | ubuntu-2404                            |
| OS-EXT-SRV-ATTR:hypervisor_hostname | None                                   |
| OS-EXT-SRV-ATTR:instance_name       | None                                   |
| OS-EXT-SRV-ATTR:kernel_id           | None                                   |
| OS-EXT-SRV-ATTR:launch_index        | None                                   |
| OS-EXT-SRV-ATTR:ramdisk_id          | None                                   |
| OS-EXT-SRV-ATTR:reservation_id      | None                                   |
| OS-EXT-SRV-ATTR:root_device_name    | None                                   |
| OS-EXT-SRV-ATTR:user_data           | None                                   |
| OS-EXT-STS:power_state              | N/A                                    |
| OS-EXT-STS:task_state               | scheduling                             |
| OS-EXT-STS:vm_state                 | building                               |
| OS-SRV-USG:launched_at              | None                                   |
| OS-SRV-USG:terminated_at            | None                                   |
| accessIPv4                          | None                                   |
| accessIPv6                          | None                                   |
| addresses                           | N/A                                    |
| adminPass                           | UhTB2oTeq9Nz                           |
| config_drive                        | None                                   |
| created                             | 2024-10-04T02:00:29Z                   |
| description                         | None                                   |
| flavor                              | description=, disk='10',               |
|                                     | ephemeral='0', , id='m1.small',        |
|                                     | is_disabled=, is_public='True',        |
|                                     | location=, name='m1.small',            |
|                                     | original_name='m1.small', ram='4096',  |
|                                     | rxtx_factor=, swap='0', vcpus='2'      |
| hostId                              | None                                   |
| host_status                         | None                                   |
| id                                  | 885b6f1a-3e80-4e0d-b6a7-9781ac46bd1a   |
| image                               | Ubuntu2404                             |
|                                     | (a9d10f1d-d836-424d-8117-ff3fc8c5e966) |
| key_name                            | mykey                                  |
| locked                              | None                                   |
| locked_reason                       | None                                   |
| name                                | Ubuntu-2404                            |
| pinned_availability_zone            | None                                   |
| progress                            | None                                   |
| project_id                          | 84e315c8d65e4b3cb33aaf69c9eed0c3       |
| properties                          | None                                   |
| security_groups                     | name='f1f9a564-53aa-4c02-b302-         |
|                                     | d89928deef8b'                          |
| server_groups                       | None                                   |
| status                              | BUILD                                  |
| tags                                |                                        |
| trusted_image_certificates          | None                                   |
| updated                             | 2024-10-04T02:00:29Z                   |
| user_id                             | d97d1aef1b234c469ad3757bcd51dfa4       |
| volumes_attached                    |                                        |
+-------------------------------------+----------------------------------------+

# when starting normally, the status turns to [ACTIVE]

ubuntu@dlp ~(keystone)$
openstack server list

+--------------+-------------+--------+---------------+------------+----------+
| ID           | Name        | Status | Networks      | Image      | Flavor   |
+--------------+-------------+--------+---------------+------------+----------+
| 885b6f1a-    | Ubuntu-2404 | ACTIVE | sharednet1=10 | Ubuntu2404 | m1.small |
| 3e80-4e0d-   |             |        | .0.0.224      |            |          |
| b6a7-        |             |        |               |            |          |
| 9781ac46bd1a |             |        |               |            |          |
+--------------+-------------+--------+---------------+------------+----------+
[2] Configure security settings for the security group you created above to access with SSH and ICMP.
# permit ICMP

ubuntu@dlp ~(keystone)$
openstack security group rule create --protocol icmp --ingress secgroup01

+-------------------------+--------------------------------------+
| Field                   | Value                                |
+-------------------------+--------------------------------------+
| belongs_to_default_sg   | False                                |
| created_at              | 2024-10-04T02:02:16Z                 |
| description             |                                      |
| direction               | ingress                              |
| ether_type              | IPv4                                 |
| id                      | bceea50a-7ea5-4205-befa-79db37cd1ffe |
| name                    | None                                 |
| normalized_cidr         | 0.0.0.0/0                            |
| port_range_max          | None                                 |
| port_range_min          | None                                 |
| project_id              | 84e315c8d65e4b3cb33aaf69c9eed0c3     |
| protocol                | icmp                                 |
| remote_address_group_id | None                                 |
| remote_group_id         | None                                 |
| remote_ip_prefix        | 0.0.0.0/0                            |
| revision_number         | 0                                    |
| security_group_id       | f1f9a564-53aa-4c02-b302-d89928deef8b |
| tags                    | []                                   |
| updated_at              | 2024-10-04T02:02:16Z                 |
+-------------------------+--------------------------------------+

# permit SSH

ubuntu@dlp ~(keystone)$
openstack security group rule create --protocol tcp --dst-port 22:22 secgroup01

+-------------------------+--------------------------------------+
| Field                   | Value                                |
+-------------------------+--------------------------------------+
| belongs_to_default_sg   | False                                |
| created_at              | 2024-10-04T02:02:45Z                 |
| description             |                                      |
| direction               | ingress                              |
| ether_type              | IPv4                                 |
| id                      | 87bd5993-77ed-45db-ac10-2192ba029aff |
| name                    | None                                 |
| normalized_cidr         | 0.0.0.0/0                            |
| port_range_max          | 22                                   |
| port_range_min          | 22                                   |
| project_id              | 84e315c8d65e4b3cb33aaf69c9eed0c3     |
| protocol                | tcp                                  |
| remote_address_group_id | None                                 |
| remote_group_id         | None                                 |
| remote_ip_prefix        | 0.0.0.0/0                            |
| revision_number         | 0                                    |
| security_group_id       | f1f9a564-53aa-4c02-b302-d89928deef8b |
| tags                    | []                                   |
| updated_at              | 2024-10-04T02:02:45Z                 |
+-------------------------+--------------------------------------+

ubuntu@dlp ~(keystone)$
openstack security group rule list secgroup01

+----------+-------------+-----------+----------+------------+-----------+-----------------------+----------------------+
| ID       | IP Protocol | Ethertype | IP Range | Port Range | Direction | Remote Security Group | Remote Address Group |
+----------+-------------+-----------+----------+------------+-----------+-----------------------+----------------------+
| 5934759e | None        | IPv4      | 0.0.0.0/ |            | egress    | None                  | None                 |
| -8a12-   |             |           | 0        |            |           |                       |                      |
| 41ce-    |             |           |          |            |           |                       |                      |
| 8022-    |             |           |          |            |           |                       |                      |
| 1828cfe1 |             |           |          |            |           |                       |                      |
| 1edc     |             |           |          |            |           |                       |                      |
| 87bd5993 | tcp         | IPv4      | 0.0.0.0/ | 22:22      | ingress   | None                  | None                 |
| -77ed-   |             |           | 0        |            |           |                       |                      |
| 45db-ac1 |             |           |          |            |           |                       |                      |
| 0-       |             |           |          |            |           |                       |                      |
| 2192ba02 |             |           |          |            |           |                       |                      |
| 9aff     |             |           |          |            |           |                       |                      |
| bceea50a | icmp        | IPv4      | 0.0.0.0/ |            | ingress   | None                  | None                 |
| -7ea5-   |             |           | 0        |            |           |                       |                      |
| 4205-    |             |           |          |            |           |                       |                      |
| befa-    |             |           |          |            |           |                       |                      |
| 79db37cd |             |           |          |            |           |                       |                      |
| 1ffe     |             |           |          |            |           |                       |                      |
| c93b5106 | None        | IPv6      | ::/0     |            | egress    | None                  | None                 |
| -6f45-   |             |           |          |            |           |                       |                      |
| 4bd7-    |             |           |          |            |           |                       |                      |
| 8ffd-    |             |           |          |            |           |                       |                      |
| 7b74d740 |             |           |          |            |           |                       |                      |
| 8f65     |             |           |          |            |           |                       |                      |
+----------+-------------+-----------+----------+------------+-----------+-----------------------+----------------------+
[3] Login to the instance with SSH.
ubuntu@dlp ~(keystone)$
openstack server list

+--------------+-------------+--------+---------------+------------+----------+
| ID           | Name        | Status | Networks      | Image      | Flavor   |
+--------------+-------------+--------+---------------+------------+----------+
| 885b6f1a-    | Ubuntu-2404 | ACTIVE | sharednet1=10 | Ubuntu2404 | m1.small |
| 3e80-4e0d-   |             |        | .0.0.224      |            |          |
| b6a7-        |             |        |               |            |          |
| 9781ac46bd1a |             |        |               |            |          |
+--------------+-------------+--------+---------------+------------+----------+

ubuntu@dlp ~(keystone)$
ping 10.0.0.224 -c3

PING 10.0.0.224 (10.0.0.224) 56(84) bytes of data.
64 bytes from 10.0.0.224: icmp_seq=1 ttl=64 time=1.14 ms
64 bytes from 10.0.0.224: icmp_seq=2 ttl=64 time=0.643 ms
64 bytes from 10.0.0.224: icmp_seq=3 ttl=64 time=0.491 ms

--- 10.0.0.224 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2064ms
rtt min/avg/max/mdev = 0.491/0.757/1.139/0.276 ms

ubuntu@dlp ~(keystone)$
ssh ubuntu@10.0.0.224
The authenticity of host '10.0.0.224 (10.0.0.224)' can't be established.
ED25519 key fingerprint is SHA256:rLGF9nr6DzWZiy7HDWehAgjJJBGwPusD8fOp8lWeyW0.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '10.0.0.224' (ED25519) to the list of known hosts.
Welcome to Ubuntu 24.04.1 LTS (GNU/Linux 6.8.0-44-generic x86_64)

.....
.....

To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

ubuntu@ubuntu-2404:~$     # logined
[4] If you'd like to stop an instance, it's possible to control with openstack command like follows.
ubuntu@dlp ~(keystone)$
openstack server list

+--------------+-------------+--------+---------------+------------+----------+
| ID           | Name        | Status | Networks      | Image      | Flavor   |
+--------------+-------------+--------+---------------+------------+----------+
| 885b6f1a-    | Ubuntu-2404 | ACTIVE | sharednet1=10 | Ubuntu2404 | m1.small |
| 3e80-4e0d-   |             |        | .0.0.224      |            |          |
| b6a7-        |             |        |               |            |          |
| 9781ac46bd1a |             |        |               |            |          |
+--------------+-------------+--------+---------------+------------+----------+

# stop instance

ubuntu@dlp ~(keystone)$
openstack server stop Ubuntu-2404

ubuntu@dlp ~(keystone)$
openstack server list

+--------------+-------------+---------+---------------+------------+----------+
| ID           | Name        | Status  | Networks      | Image      | Flavor   |
+--------------+-------------+---------+---------------+------------+----------+
| e499117a-    | Ubuntu-2404 | SHUTOFF | sharednet1=10 | Ubuntu2404 | m1.small |
| 58e4-4c75-   |             |         | .0.0.224      |            |          |
| 9712-        |             |         |               |            |          |
| 836d4fbe5572 |             |         |               |            |          |
+--------------+-------------+---------+---------------+------------+----------+

# start instance

ubuntu@dlp ~(keystone)$
openstack server start Ubuntu-2404

ubuntu@dlp ~(keystone)$
openstack server list

+--------------+-------------+--------+---------------+------------+----------+
| ID           | Name        | Status | Networks      | Image      | Flavor   |
+--------------+-------------+--------+---------------+------------+----------+
| 885b6f1a-    | Ubuntu-2404 | ACTIVE | sharednet1=10 | Ubuntu2404 | m1.small |
| 3e80-4e0d-   |             |        | .0.0.224      |            |          |
| b6a7-        |             |        |               |            |          |
| 9781ac46bd1a |             |        |               |            |          |
+--------------+-------------+--------+---------------+------------+----------+
[5] It's possible to access with Web browser to get VNC console.
ubuntu@dlp ~(keystone)$
openstack server list

+--------------+-------------+--------+---------------+------------+----------+
| ID           | Name        | Status | Networks      | Image      | Flavor   |
+--------------+-------------+--------+---------------+------------+----------+
| 885b6f1a-    | Ubuntu-2404 | ACTIVE | sharednet1=10 | Ubuntu2404 | m1.small |
| 3e80-4e0d-   |             |        | .0.0.224      |            |          |
| b6a7-        |             |        |               |            |          |
| 9781ac46bd1a |             |        |               |            |          |
+--------------+-------------+--------+---------------+------------+----------+

ubuntu@dlp ~(keystone)$
openstack console url show Ubuntu-2404

+----------+-------------------------------------------------------------------+
| Field    | Value                                                             |
+----------+-------------------------------------------------------------------+
| protocol | vnc                                                               |
| type     | novnc                                                             |
| url      | https://dlp.srv.world:6080/vnc_auto.html?path=%3Ftoken%3D1e2cedc3 |
|          | -b636-47a3-b624-568b74a236f3                                      |
+----------+-------------------------------------------------------------------+
[6] Access to the URL which was displayed by the command above.
Matched Content