In this exercise, you will create the minimum resources required to configure a simple virtual machine instance, launch the instance, and verify that the instance launch is successful.
Outcomes
You should be able to:
Verify all the resources needed for an instance to launch.
Launch a new instance using the command line.
Connect to the instance console.
Delete an instance using its ID.
Log in to the Dashboard.
Launch an instance using the Dashboard.
Verify that the instance is running properly.
As the student user on the workstation machine, use the lab command to prepare your system for this exercise.
This command ensures that all resources required for the exercise are present.
[student@workstation ~]$ lab intro-launching start
Procedure 1.1. Instructions
This guided exercise is in two parts. In part 1 you use the CLI to launch an instance, and in part 2 you use the Dashboard to review that instance and launch a new instance using the same parameters.
Source the developer1 environment file, /home/student/developer1-finance-rc, from the command line. The environment file sets the identity service authentication endpoint, and the user name, password, domain, and project to be referenced by the OpenStack unified CLI.
[student@workstation ~]$ source ~/developer1-finance-rc
[student@workstation ~(developer1-finance)]$Use the openstack flavor list command to list the available flavors.
[student@workstation ~(developer1-finance)]$openstack flavor list+-------------+---------+------+------+-----------+-------+-----------+ | ID | Name | RAM | Disk | Ephemeral | VCPUs | Is Public | +-------------+---------+------+------+-----------+-------+-----------+ |6586...fc13| default | 2048 | 10 | 0 | 2 | True | ...output omitted... +-------------+---------+------+------+-----------+-------+-----------+
Use the openstack image list command to list all the available images.
[student@workstation ~(developer1-finance)]$openstack image list+--------------------------------------+--------+--------+ | ID | Name | Status | +--------------------------------------+--------+--------+ |6533cafe-7629-48ea-aef1-1efcc7a09913| rhel8 | active | ...output omitted... +--------------------------------------+-------+---------+
Use the openstack image show command with the name of the image to see detailed information about the image.
[student@workstation ~(developer1-finance)]$openstack image show rhel8+------------------+-----------------------------------------------------------+ | Field | Value | +------------------+-----------------------------------------------------------+ | checksum |c4fdd1059af61b68ce342a6ed35cb357| | container_format | bare | | created_at |2020-04-07T02:10:32Z| | disk_format | qcow2 | | file | /v2/images/6533cafe-7629-48ea-aef1-1efcc7a09913/file | | id |6533cafe-7629-48ea-aef1-1efcc7a09913| | min_disk | 10 | | min_ram | 2048 | | name | rhel8 | | owner |903ebb6e211a4bf093f8a7215784682e| | properties | architecture='x86_64', | | | direct_url='rbd://63e5c992-81fb-11ea-bc11-52540001fac8/im | | | ages/b33fca9a-3c85-40b3-86bf-466eeaccbf6b/snap', | | | locations='[{'url':'rbd://63e5c992-81fb-11ea-bc11-525400 | | | 01fac8/images/b33fca9a-3c85-40b3-86bf-466eeaccbf6b/snap', | | | 'metadata': { }}]', os_hash_algo='sha512', os_hash_value=' | | | 51bad92d5265db82e71f7917ecb69c598dfb7cc95c7b05876971686ad | | | dc91396dc900c050bc41ffc69799167d38efa2ec179dcaf6b4e5fe1f7 | | | 9c07c1b4781d03', os_hidden='False' | | protected | False | | schema | /v2/schemas/image | | size | 844890112 | | status | active | | tags | | | updated_at |2020-04-07T02:10:53Z| | virtual_size | None | | visibility | public | +------------------+-----------------------------------------------------------+
Use the openstack help command to get help using OpenStack CLI commands. For example, use the subcommandsopenstack help flavor list command to determine how to display all available flavors.
[student@workstation ~(developer1-finance)]$ openstack help flavor list
usage: openstack flavor list [-h] [-f {csv,json,table,value,yaml}] [-c COLUMN]
[--quote {all,minimal,none,nonnumeric}]
[--noindent] [--max-width <integer>]
[--fit-width] [--print-empty]
[--sort-column SORT_COLUMN]
[--public | --private | --all] [--long]
[--marker <flavor-id>] [--limit <num-flavors>]
List flavors
...output omitted...Use the openstack server create command to create the finance-server1 instance. Use the rhel8 image, finance-network1 as the network and default as the flavor.
[student@workstation ~(developer1-finance)]$openstack server create \>--image rhel8 \>--flavor default \>--nic net-id=finance-network1 \>--wait finance-server1+-----------------------------+-----------------------------------------------+ | Field | Value | +-----------------------------+-----------------------------------------------+ | OS-DCF:diskConfig | MANUAL | | OS-EXT-AZ:availability_zone | nova | | OS-EXT-STS:power_state | Running | | OS-EXT-STS:task_state | None | | OS-EXT-STS:vm_state | active | | OS-SRV-USG:launched_at | 2020-04-15T09:34:03.000000 | | OS-SRV-USG:terminated_at | None | | accessIPv4 | | | accessIPv6 | | | addresses |finance-network1=192.168.1.31| | adminPass | FdP6Zc9Hz7Ks | | config_drive | | | created |2018-06-01T11:55:39Z| | flavor |default(6586868d-c5bb-4e09-b68f-392a755afc13)| | hostId | f0df...635d | | id | 89f48040-970c-434f-bb0f-6fc5abd6b2fb | | image |rhel8(6533cafe-7629-48ea-aef1-1efcc7a09913) | | key_name | None | | name |finance-server1| | progress | 0 | | project_id | 903ebb6e211a4bf093f8a7215784682e | | properties | | | security_groups | name='default' | | status | ACTIVE | | updated | 2020-04-15T09:34:03Z | | user_id | fc318aa670314cc08148c4828b71bdc2 | | volumes_attached | | +-----------------------------+-----------------------------------------------+
Use the openstack server list command to list the available instances. Confirm that the Status is ACTIVE.
[student@workstation ~(developer1-finance)]$openstack server list -f json[ { "ID": "89f48040-970c-434f-bb0f-6fc5abd6b2fb", "Name": "finance-server1", "Status": "ACTIVE", "Networks": "finance-network1=192.168.1.31", "Image": "rhel8", "Flavor": "default" } ]
Use the openstack console log show command to read the log for the active instance.
[student@workstation ~(developer1-finance)]$openstack console log show \>finance-server1...output omitted... Red Hat Enterprise Linux Server 8.1 (Ootpa) Kernel 4.18.0-147.el8.x86_64 on an x86_64 small image Activate the web console with: systemctl enable --now cockpit.socket finance-server1 login: [student@workstation ~(developer1-finance)]$
Use the openstack console url show command to display the instance console URL. Open the URL with your browser to access the instance VNC console.
[student@workstation ~(developer1-finance)]$openstack console url show \>finance-server1+-------+----------------------------------------------------------------------+ | Field | Value | +-------+----------------------------------------------------------------------+ | type | novnc | | url | http://172.25.250.50:6080/vnc_auto.html?token=962dfd71-f047-43d3-89 | | | a5-13cb88261eb9 | +-------+----------------------------------------------------------------------+
To view the console, open the URL link from the previous step with Firefox.
[student@workstation ~(developer1-finance)]$ firefox http://172.25.250.50:6080/vnc_auto.html?token=962dfd71-f047-43d3-89a5-13cb88261eb9To verify the instance configuration, log in as root using redhat as the password.
...output omitted... finance-server1 login:rootPassword:redhat[root@finance-server1 ~]#
Use the ping command to reach the IP address of the DHCP server from inside the instance.
[root@finance-server1 ~]# ping -c3 192.168.1.2
PING 192.168.1.2 (192.168.1.2) 56(84) bytes of data.
64 bytes from 192.168.1.2: icmp_seq=1 ttl=63 time=0.642 ms
64 bytes from 192.168.1.2: icmp_seq=2 ttl=63 time=0.457 ms
64 bytes from 192.168.1.2: icmp_seq=3 ttl=63 time=0.596 ms
--- 192.168.1.2 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.457/0.565/0.642/0.078 msSwitch back to the terminal window and use the openstack server delete command with the UUID of the instance to delete the finance-server1 instance.
[student@workstation ~(developer1-finance)]$openstack server delete \>89f48040-970c-434f-bb0f-6fc5abd6b2fb
Use the openstack server list command again to list the available instances.
[student@workstation ~(developer1-finance)]$ openstack server list -f json
[]
[student@workstation ~(developer1-finance)]$Use the Dashboard to perform the following steps.
Use the Dashboard to create an instance using the same parameters as before. On workstation, open Firefox and navigate to http://dashboard.overcloud.example.com.
Log in to the Dashboard using Example as the domain name, developer1 as the user name, and redhat as the password.
Click the menu and ensure that is the current project.
Launch an instance named finance-server1 using the default flavor, the rhel8 image, and the finance-network1 network. Click under .
Navigate to → and then click .
On the tab, enter finance-server1 in the field.
On the tab, select in the field.
From the list of available images, click the up arrow corresponding to the rhel8 image. Click under .
On the tab, from the list of available flavors, click the up arrow corresponding to the default flavor.
On the tab, if the finance-network1 network is not already allocated, click the up arrow corresponding to that network to allocate it.
Click to launch the finance-server1 instance.
Wait a few seconds and then verify the status of the instance in the column. The instance should be in a Running state.
Right-click the instance link and choose . In the new tab, click the tab and then click the link. If a certificate error appears, accept the self-signed certificate. Watch the virtual machine boot. It may have already finished booting.
To verify the launch, log in to the finance-server1 instance as the root user with redhat as the password.
...output omitted... finance-server1 login:rootPassword:redhat[root@finance-server1 ~]#
List the routing table to find the gateway server IP address.
[root@finance-server1 ~]#ip route showdefault via192.168.1.1dev eth0 proto dhcp metric 100 169.254.169.254 via 192.168.1.2 dev eth0 proto dhcp metric 100 192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.3 metric 100
Determine if the gateway (192.168.1.1 in the previous example output) server is reachable from finance-server1.
[root@finance-server1 ~]# ping -c3 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
From 192.168.1.3: icmp_seq=1 Destination Host Unreachable
From 192.168.1.3: icmp_seq=2 Destination Host Unreachable
From 192.168.1.3: icmp_seq=3 Destination Host Unreachable
--- 192.168.1.1 ping statistics ---
3 packets transmitted, 0 received, +3 errors, 100% packet loss, time 1000msAt this point, no external router is attached to this network, so it does not have an active gateway and you cannot ping any address outside of the 192.168.1.0/24 network.
Verify that the DHCP server is reachable from finance-server1. The DHCP server IP address in this exercise is 192.168.1.2.
In the instance console, verify the connectivity using the ping command with the IP address of the DHCP server, 192.168.1.2.
[student@finance-server1 ~]$ ping -c3 192.168.1.2
PING 192.168.1.2 (192.168.1.2) 56(84) bytes of data.
64 bytes from 192.168.1.2: icmp_seq=1 ttl=63 time=0.642 ms
64 bytes from 192.168.1.2: icmp_seq=2 ttl=63 time=0.457 ms
64 bytes from 192.168.1.2: icmp_seq=3 ttl=63 time=0.596 ms
--- 192.168.1.2 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.457/0.565/0.642/0.078 msClose the instance tab in the browser. Click → in the upper-right corner to log out of the Dashboard.
This concludes the guided exercise.