Latest
Total Page:16
File Type:pdf, Size:1020Kb
stfc-cloud-docs Documentation Release 1.0 CloudTeam Aug 19, 2021 Getting Started: 1 Common Commands 1 2 How-To Articles 3 3 Policies 37 4 Contact Details 41 5 FAQS 43 6 Fault Fixes 51 7 Flavors 53 8 Image Types 55 9 Reference Documents 57 10 Aodh and Gnocchi 73 11 Improving this Documentation 93 12 Heat 95 13 Magnum 117 14 Octavia 147 15 Legacy Documentation 173 16 Indices and tables 179 i ii CHAPTER 1 Common Commands On Queens, Hypervisors often disable themselves and remove their services from the pool of resources if there are 10 build failures in a row on a hypervisor. 1.1 List available images To list available images do: openstack image list 1.2 List available flavors To list available flavors run: openstack flavor list 1.3 List available networks To list available networks run: openstack network list 1.4 List running servers Showing all hosts in your current projects: 1 stfc-cloud-docs Documentation, Release 1.0 openstack server list 1.5 Show a specific server Looking at a specific server:- openstack server show <server ID> 2 Chapter 1. Common Commands CHAPTER 2 How-To Articles 2.1 Adding Your SSH Key into the OpenStack Web Interface 2.1.1 Overview This document describes how to add your public ssh key into the openstack ssh web user interface (https://openstack. stfc.ac.uk). It assumes you have already contacted [email protected] to either initiate a project, or to add user accounts to an existing project. It also assumes you already have an SSH key pair generated, and you just wish to add your existing public ssh key. You need to import you ssh public key into the Openstack web interface as then the system will inject your ssh public key (and username) into any Virtual machine that you create. 2.1.2 Procedure Login to the web site: https://openstack.stfc.ac.uk using the credentials you have been given. If you have a STFC FEDID account, make sure that you set the “Domain” to be “STFC Federal ID”:- 3 stfc-cloud-docs Documentation, Release 1.0 AddingSSHKeysInWebInterface Once logged in, click on the Left Hand Side “Compute” option, and then “Key Pairs”. You should see a screen similar to below, with the exception that if this is your first time connecting in, no key pairs will be listed:- If you do not already have an SSH key pair, you can use the “Create key pair” button. If you have an existing ssh key pair, you should click on the “Import Public Key” button. On doing so, a pop-up window will appear:- 4 Chapter 2. How-To Articles stfc-cloud-docs Documentation, Release 1.0 From here, you can cut and paste your “id_rsa.pub” key (often found on a linux host you already have ssh access to, in the ~/.ssh directory – you can run “cat authorized_keys” to display the key and then cut and paste it into the web-browser window. Give the key pair a name as well. NOTE: Be very careful with pasting the key, or importing it via the file “Browse” button: SSH keys are very sensitive to any of the characters being incorrect, including line feed characters – the key should be one continuous line, without spaces, Carriage Returns or Line Feed characters 2.2 Adding a user account to multiple cloud hosts within a project 2.2.1 Outline For some types of Openstack projects, it’s common to have a list of user accounts, that may or may not be external users, that need ssh access to a (large) number of hosts within that project. This document provides an outline approach as to how to approach this task. 2.2.2 Method Make sure you have root access to the systems, or at the very least, have a login to each system with sudo access. If you are using a ssh key pair to login (the preferred method within STFC), make sure you have your private key loaded on a ssh-agent and ensure that “Agent forwarding” feature is enabled. If this is a common task that you have to do, it is worth using the same “command and control” hosts in all of your operations for running scripts on the hosts within projects. Step 1 – Find the list of hosts within a project Find the project from: Openstack project list | grep –v 844e | grep –v rally . from there, you can list all of the virtual machines that are in a particular project:- Openstack server list –project “Rucio at RAL” This will return a list of hostnames and their IP addresses (and float IP addresses). You 2.2. Adding a user account to multiple cloud hosts within a project 5 stfc-cloud-docs Documentation, Release 1.0 can make this just a list of IP addresses using something like:- openstack server list –project “Rucio at RAL” | awk -F| ‘{ print $5 }’ | grep ‘Internal’ | sed ‘s/^ Internal=//’ . .which just returns a list of the 172.16.x.y network IP addresses – there is no point in returning the 192.168.x.y IP addresses as you cannot directly ssh to these anyway, but any float IP addresses, you could append as needed. Output this to a file “all_IP_addresses.text”. Check login to each host, identify host and check which hosts have users enabled on them 2.3 Associate a floating IP to a VM Assumes that you have float-IPs associated with your project. If you do not - contact Cloud Support. In the Horizon Web user interface (https://Openstack.stfc.ac.uk) in the Left Hand Side Menu, select:- Compute->Instances Find the VM (that has a Private 192.168.x.y IP address) that you wish to associate a Floating IP address with. On the Right Hand side, click on the down arrow, and select “ASSOCIATE FLOATING IP” - a pop-up window will appear. Click on “Select an IP address” - a drop-down list of available floating IP addresses will be listed. Click on one. Click on the “ASSOCIATE” button. You should be returned to the “Instances” list, and you should now see your float-IP associated with your VM, as well as its original 192.168.x.y address. For the equivalent using the openstack API command line:- To find float-IP addresses associated with your project, use the command:- openstack floating ip list –project “project name” . where project name is your project name in quotations. This will return a list of float IP addresses, and will show which ones are in use, and which ones are not. Take note of one of the float IP addresses that is free. Now list the VM instances in your project, use the command:- openstack server list –project “project name” . .will list all of your VM instances. Take note of the first column, which is the instance ID of your chosen VM. To associate a floating IP selcted earlier, use the command:- openstack server add floating ip <VM instance ID> <Floating IP> This should then result with the floating IP address being associated with the floating IP names. You should now be able to ssh directly into the VM, using the floating IP address as a target, assuming that the security group allows ssh inbound, and any additional firewalls in the way, also have ssh allowed inbound. 2.4 Configuring SSH Agent Forwarding in Windows Subsystem for Linux Configuring WSL is pretty easy, this link offers a good tutorial. https://www.windowscentral.com/install-windows-subsystem-linux-windows-10 Ensure your distribution of Linux in WSL is fully up to date (some versions have known issues around agent forward- ing). I used Ubuntu 18.04 LTS so I ran: sudo apt-get update sudo apt-get upgrade 6 Chapter 2. How-To Articles stfc-cloud-docs Documentation, Release 1.0 This left me with a nice up to date install. You can then run the following commands to start and add your key to the ssh agent: eval $(ssh-agent -s) ssh-add <path-to-your-ssh-private-key> Then you can ssh to your host with agent forwarding using ssh -A <your-remote-host> Then you can SSH on from there. 2.5 Configuring an X Server in Windows Subsystem for Linux First select a Windows based X server such as Xming or VcXsrv I chose to use VcXsrv, download and install this. At time of writing the default installation options work fine. Launch VcXsrv by running XLaunch Open your WSL window and run the following command to set your default display: export DISPLAY=localhost:0.0 You should then be able run X applications You can test this by running sudo apt install x11-apps then xclock You should then see a little graphical clock appear somewhere on your screen. To be able to use this remotely you will need to generate an XAuthority file. This can be done with the following: xauth generate :0 . trusted You should then be able to ssh into a remote host with the following command provided that the remote host is appropriately configured : ssh -X <user>@<your.remote.host> 2.6 Create a Heat stack Heat is an orchestration component of OpenStack which allows templates to be used to define resources and to specify the relationships between resources in a stack. To check Heat is available we can run the command: openstack stack list 2.5. Configuring an X Server in Windows Subsystem for Linux 7 stfc-cloud-docs Documentation, Release 1.0 This command returns the list of stacks in the user’s project.