How to Launch an OpenStack Instance using Horizon Dashboard
Abstract: we would need to perform the below tasks. Create OpenStack Image Create Machine Flavor Create Security Group Generate Key Pair Create OpenStack Image
This article is the third part of our OpenStack series. In this tutorial, we will go through steps to launch an OpenStack instance from Horizon Dashboard.
Prerequisites1: Install Single Node OpenStack in CentOS 7 / RHEL 7
2: Configure OpenStack Networking to Enable Access to VM Instances
Launch OpenStack InstanceBefore launching an instance, we would need to perform the below tasks.
- Create OpenStack Image
- Create Machine Flavor
- Create Security Group
- Generate Key Pair
Without virtual machine images, you can not deploy OpenStack instances. OpenStack Image is a single file (QCOW2 or Raw) which contains a disk that has an operating system installed on it.
For this demo, we will use CentOS 6 image and upload it to OpenStack.
In case you want to use some other image, get it from here.
Login as admin user and perform the below tasks.
To Create Image, Go to Admin >> Compute >> Images >> + Create Image.
Enter the details.
Image Name: CentOS 6 x86_64
Image Description: CentOS 6 Image
Image Source: Browse the downloaded image (My image is in ~/raj – Home directory).
Format: QCOW2 – QEMU Emulator
Create OpenStack ImageClick Create Image to begin. Wait for few minutes to complete.
Launch an OpenStack Instance – OpenStack Image Creation in ProgressNote: Image will be accessible to all OpenStack users, by default.
Create Machine FlavorMachine Flavors are varying combinations of CPU, memory, storage and swap capacity and let you choose the correct mix of resources for your requirement.
Though OpenStack has predefined flavors creating a new machine flavor could match the exact resource requirement for your application.
Let us create a flavor for 1VCPU, 1GB RAM, and 10GB Disk.
Go to Admin >> Compute >> Flavors >> + Create Flavor. You should be in OpenStack admin login.
Flavor details,
Name: custom.small
VCPUs: 1
RAM: 1024
Root Disk: 10 GB
Note: Any OpenStack user can use this flavor to create instances, by default.
Create Security GroupOpenStack security group acts as a virtual firewall that controls the connection to/from instances. Security groups should be created to allow connections like SSH, HTTP, HTTPS, etc.
Here, we will create a security group to allow ICMP and SSH connections.
Login as a normal user 「raj」.
OpenStack User LoginGo to Project >> Network >> Security Groups >> + Create Security Group.
In this page, name your security group and click Create Security Group.
Create Security GroupNow, click Manage Rules of the newly created group.
Manage Security RulesAdd a rule something like below.
Project >> Network >> Security Groups >> Security Group (ITzGeek_Security) >> Manage >> + Add Rule.
SSH:
Rule: SSH / ICMP
Remote: CIDR
CIDR: 0.0.0.0/0
ICMP:
Rule: All ICMP
Direction: Ingress
Remote: CIDR
CIDR: 0.0.0.0/0
The key pair is the public key which is used for accessing the created instances. Without the key pair, we can not access the instance.
Go to Project >> Compute >> Key Pairs >> + Create Key Pair.
Create Key PairUse Right click and Copy or Click Copy Private Key to Clipboard and save the key pair to the file (in my case, it is ITzGeek-Key) for future use.
Copy Private KeyNow, we are ready to launch an instance.
Launch an instanceGo to Project >> Compute >> Instances >> Launch Instance.
Name your instance and click next.
Create OpenStack VMSelect the uploaded (CentOS 6 x86_64) image as the source for this instance.
Choose VM ImageWe will use our custom.small flavor so that OpenStack can allocate resources easily for us.
Choose Machine FlavorChoose the Internal_Network.
Choose NetworkSelect the security group we created earlier.
Choose Security GroupMake sure you select the correct key pair. Finally, click Launch Instance to begin the instance creation.
Select Key Pair & Launch InstanceWait for few minutes. The instance should be up and run in few minutes.
VM InstancesOnce the instance is up, assign a floating IP to the instance so that we can access the instance. Click Associate Floating IP.
Assign Floating IP to VMClick + sign.
Manage Floating IP AssociationUse External_Network and then click Associate IP.
Choose Allocation NetworkFinally, click Associate.
Map the IPYour instance should have a floating IP address assigned to it.
OpenStack Instance Running with Floating IP Access OpenStack InstanceWait for few seconds and try ping to the floating IP address. You should get a ping response.
ping 192.168.201 -c 2Ping VM Instance
As I said already, I have saved Key pair in the file called 「ITzGeek-Key「. When I save a file, it saved in 644 permission. The file permission should be changed to 600 for using with SSH for connecting to OpenStack instance.
chmod 600 ITzGeek-KeyChange Key Pair Permission
Now try accessing the instance using the floating IP with the created key pair.
The default username for CentOS cloud image is centos.
ssh -i ITzGeek-Key [email protected]
Type yes to connect to the instance as you are connecting for the first time.
You should now be in the terminal of the newly created instance.
Connect OpenStack VM InstanceThat’s All.