Bookmark this page

Guided Exercise: Launching an Instance

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.

  1. 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)]$
  2. 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...
    +-------------+---------+------+------+-----------+-------+-----------+
  3. 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...
    +--------------------------------------+-------+---------+
  4. 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                                                    |
    +------------------+-----------------------------------------------------------+

    Note

    Use the openstack help subcommands command to get help using OpenStack CLI commands. For example, use the openstack 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...
  5. 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            |                                               |
    +-----------------------------+-----------------------------------------------+
  6. 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"
                                }
    ]
  7. 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)]$
  8. 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                                                      |
    +-------+----------------------------------------------------------------------+
  9. 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-13cb88261eb9
  10. To verify the instance configuration, log in as root using redhat as the password.

    ...output omitted...
    finance-server1 login: root
    Password: redhat
    [root@finance-server1 ~]#
  11. 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 ms
  12. Switch 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
  13. 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)]$

    Note

    Use the Dashboard to perform the following steps.

  14. 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.

  15. Log in to the Dashboard using Example as the domain name, developer1 as the user name, and redhat as the password.

  16. Click the Project menu and ensure that finance is the current project.

  17. Launch an instance named finance-server1 using the default flavor, the rhel8 image, and the finance-network1 network. Click No under Create New Volume.

    1. Navigate to ComputeInstances and then click Launch Instance.

    2. On the Details tab, enter finance-server1 in the Instance Name field.

    3. On the Source tab, select Image in the Select Boot Source field.

      From the list of available images, click the up arrow corresponding to the rhel8 image. Click No under Create New Volume.

    4. On the Flavor tab, from the list of available flavors, click the up arrow corresponding to the default flavor.

    5. On the Networks tab, if the finance-network1 network is not already allocated, click the up arrow corresponding to that network to allocate it.

    6. Click Launch Instance to launch the finance-server1 instance.

  18. Wait a few seconds and then verify the status of the instance in the Power State column. The instance should be in a Running state.

  19. Right-click the finance-server1 instance link and choose Open Link in New Tab. In the new tab, click the Console tab and then click the Click here to show only console link. If a certificate error appears, accept the self-signed certificate. Watch the virtual machine boot. It may have already finished booting.

  20. 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: root
    Password: redhat
    [root@finance-server1 ~]#
  21. List the routing table to find the gateway server IP address.

    [root@finance-server1 ~]# ip route show
    default via 192.168.1.1 dev 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
  22. 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 1000ms

    At 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.

  23. 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 ms
  24. Close the instance tab in the browser. Click developer1Sign Out in the upper-right corner to log out of the Dashboard.

Finish

On the workstation machine, use the lab command to complete this exercise. This is important to ensure that resources from previous exercises do not impact upcoming exercises.

[student@workstation ~]$ lab intro-launching finish

This concludes the guided exercise.

Revision: cl110-16.1-4c76154