Skip to content

Milestone9:OpenstackTutorials

Beth edited this page Nov 3, 2024 · 8 revisions

Replace openstack with microstack.openstack

Run through the openstack ubuntu tutorials: https://ubuntu.com/openstack/tutorials

Tutorial 3: Services

List all active openstack services with sudo microstack.openstack catalog list

List all active users with sudo microstack.openstack user list

List all images on the server with sudo microstack.openstack image list

List all the virtual networks on the server with sudo microstack.openstack network list

List the hypervisors with sudo microstack.openstack hypervisor list

Tutorial 4: Dashboard

This tutorial just goes over how to navigate the dashboard. I want to be able to reference it later, but I don't feel like taking notes on everything at this moment

https://ubuntu.com/tutorials/navigate-through-the-openstack-dashboard-menu#1-overview

You can create a new user with sudo microstack.openstack create user --project [project name - I used admin] --password [new user password] [new user username]

I don't have a screenshot of my output since it would show my password but this is how it should look

{177F3EDD-EA0D-4A33-83F6-FACDFE0CA72D}

Tutorial 5: Templates

Download the image from this page: https://ubuntu.com/tutorials/manage-instance-templates-including-images-and-flavors#2-manage-images

Upload it to the openstack server with:

  • openstack image create --disk-format qcow2 --min-disk 8 --min-ram 512 --file ~/Downloads/focal-server-cloudimg-amd64-disk-kvm.img --private ubuntu-focal

This allows for 8gb minimum disk size and 512gb minimum RAM

Then list the images

{75002D17-A478-4FD9-9245-70C5ACEF8E34}

You can do the same thing with the web ui

Go to project > compute > images, and create a new image

{E9F9DCBF-A045-4ADC-8D1D-57FCE69B759A}

{7ADBE661-794E-4F2C-8B6C-5880D3BCC890}

You can also create new flavors with open stack, you can run this command to make a new flavor with 1GB ram, 10 gb disk space, and 1 cpu

  • microstack.openstack flavor create --ram 1024 --disk 10 --vcpus 1 myflavor

{B6AF7E08-3BCA-47FC-B127-1899126DDCA3}

List all the flavors with microstack.openstack flavor list

{122BF201-518F-466A-A8C8-AA337E048B2C}

Through the web ui you can manage images by going to admin > compute > flavors

{730C35F4-924B-469B-8C6A-1E9E9037DA60}

{E39E8101-2F1C-4B84-91B1-8E8D16547368}

Tutorial 6: Identities

Create a new domain with microstack.openstack domain create mydomain, list active domains with microstack.openstack domain list

{907C6E68-7C95-48EB-989F-9C0EB8C21428}

Create a domain user microstack.openstack user create --domain mydomain --password admin admin and add them to a role with microstack.openstack role add --domain mydomain --user-domain mydomain --user admin admin

{8137CEA7-5824-45D7-9062-2440C9770B63}

Create a role called member and list all roles with the following:

  • microstack.openstack role create _member_
  • microstack.openstack role list

{C382B575-BBBD-40E1-8A2D-4A067FB4EA21}

Create a project and list all projects

  • microstack.openstack project create --domain mydomain myproject
  • microstack.openstack project list --domain mydomain
Screenshot 2024-10-30 at 5 49 58 PM

Create projects with the web ui

  • Identity > projects, click create projects
Screenshot 2024-10-30 at 5 52 17 PM

Create and list all users

  • microstack.openstack user create --domain mydomain --password mypassword myuser
  • microstack.openstack user list --domain mydomain
Screenshot 2024-10-30 at 5 57 07 PM

Create and list groups

  • microstack.openstack group create --domain mydomain mygroup
  • microstack.openstack group list --domain mydomain
Screenshot 2024-10-30 at 6 01 04 PM

Manage grouand users through the web ui

  • Identity > Users
  • Identity > Groups
Screenshot 2024-10-30 at 6 03 44 PM Screenshot 2024-10-30 at 6 04 09 PM

Add a user to a group and assign the member role to a group in a project:

  • microstack.openstack group add user --group-domain mydomain --user-domain mydomain mygroup myuser
  • microstack.openstack role add --project myproject --project-domain mydomain --group mygroup --group-domain mydomain member

Assign roles to a user in the domain (finishing setting up the domain user)

  • microstack.openstack role add --project myproject --project-domain mydomain --user admin --user-domain mydomain member
  • microstack.openstack role add --project myproject --project-domain mydomain --user admin --user-domain mydomain admin

Tutorial 7: Tenancy

This seems to be going over everything we've already learned from another perspective, so I will summarize:

Openstack supports multi-tenancy, which is the ability to manage multiple organizations within the form of domains, and multiple subsets of organizations in the form of projects. This allows users within a domain to only see and manage their own domain, and does not allow them to see the domains of other organizations.

I was not able to log in as "myuser" but we also learned how to create a list keypairs:

  • microstack.openstack keypair create --private-key ./mykeypair.pem --type ssh mykeypair
  • microstack.openstack keypair list

Tutorial 8: Networking

From here on out I am not doing all of this because I don't want to set up a whole redundant network

You can view your network topology in Project > Network > Network Topology

image

You can create and list networks and subnets with the following commands:

  • microstack.openstack network create mynetwork

  • microstack.openstack network list

  • microstack.openstack subnet create --network mynetwork --subnet-range 192.168.0.0/24 --allocation-pool start=192.168.0.101,end=192.168.0.200 --dns-nameserver 8.8.8.8 mysubnet

  • microstack.openstack subnet list

You can also do all of this in Project > Network > Network topology

To create and manage routers, use the following command:

  • microstack.openstack router create myrouter
  • microstack.openstack router list
  • microstack.openstack router set --external-gateway external-network myrouter - sets the external gateway network for the router
  • microstack.openstack router add subnet myrouter mysubnet - adds the router to a subnet

This can also be done in Project > Network > Routers

Allocate and list floating ips:

  • microstack.openstack floating ip create external-network
  • microstack.openstack floating ip list

This can also be done in Project > Network > Floating IPs

Manage Security groups:

  • microstack.openstack security group create mysecuritygroup
  • microstack.openstack security group list
  • microstack.openstack security group rule create --remote-ip 0.0.0.0/0 --dst-port 22:22 --protocol tcp --ingress mysecuritygroup - adds a rule to the security group
  • microstack.openstack security group rule list mysecuritygroup - list all rules in the security group

This can also be done in Project > Network > Security Groups

Tutorial 9: Instances

Launch and list instances

  • microstack.openstack server create --flavor myflavor --image ubuntu --network mynetwork --key-name mykeypair --min 2 --max 2 myinstance
  • microstack.openstack server list

This can also be done in Project > Compute > Instances

Associate a floating ip:

  • IP=$(microstack.openstack floating ip list | tail -n 2 | head -n 1 | awk '{print $4}')
  • microstack.openstack server add floating ip myinstance-1 $IP

This can also be done in Project > Compute > Instances > Action on the instance

Attach a security group

Start by modifying the permissions in the keypair file

  • chmod 0400 ~/Downloads/mykeypair.pem

If you attempt to ssh, like so:

  • IP=$(microstack.openstack floating ip list | tail -n 2 | head -n 1 | awk '{print $4}')
  • ssh -i ~/Downloads/mykeypair.pem -o StrictHostKeyChecking=no ubuntu@$IP

It will time out

This is because the default security group does not allow ssh connections. Attach a security group:

  • microstack.openstack server add security group myinstance-1 mysecuritygroup

This can also be done in Project > Compute > Instances > Actions, Edit Security Groups

After this you should be able to ssh into the instance

To delete instances:

  • microstack.openstack server delete myinstance-2

This can also be done in Project > Compute > Instances > Actions, delete instance

Clone this wiki locally