Openstack - The Journey

openstack" Icon - Download for free – Iconduck

There is a TON to know about Openstack. I tend to want to understand how software works under the hood before I care as much about how to use it. Openstack is so vast though that I ended up kinda doing these in parallel. Training videos are helpful but without a sandbox they really only provide a high level understanding. 

Installing

The first thing to know about openstack is that it is not one piece of software, it is a collection of projects that are designed to integrate. There are a few required for basic function and others, like Heat, are popular but not required. The other thing to know is that it is designed to be installed on 3 nodes, although it can be installed on a single machine.

I spend a good amount of time trying to figure out how to install openstack and reading several methods which I later figured out are more opinions of the best way. You can purchase openstack as a service from some cloud providers like openmetal (which sponsors a lot of youtube videos), but if you are like me you want to get into the guts of it. So, here's a breakdown of the common ways to install.

  • Devstack
    • This is a script that wil automate the entire install with a few keystrokes in about 20 min. This  is designed to be a test environment and if set it up to bridge network to your LAN, it is not designed to survive a reboot. So, use a VM and create snapshots.
  • Pacstack 
    • This comes up a lot, but as far as I can tell it's depreciated or at least not very popular anymore. This is a repository you can add to a linux distro to install on a single node via package manager.
  • Kolla-Ansible
    • This automates the install using Ansible automation software and Kolla is a container deployment tool for openstack. If you are not already familiar with Ansible, this may not be an 'easy' install. The openstack configuration is done in the automation software, which, if you aren't familiar with Openstack or Ansible could lead to confusion as to what is being configured during setup.
  • Tripple-O
    • This stands for Openstack On Openstack. Essentially you use the first install of openstack as a control plane and orchestration for the 'second' install of openstack which runs workloads. This is the method described in the RedHat documentation.
  • Manual
    • This means following the Openstack installation guide step by step. This will teach you the most about the structure and configuration of the software. The instructions are pretty detailed and it's not that difficult, but it is very tedious.

I decided to manually install 3 VM nodes on my server after trying out devstack.I found that understanding how to use Openstack was pretty valuable when leaning how to install it. Due to its modular nature, using it really helped me understand what the components do and what they are called.

Along the way I made some notes of useful commands which are below.

# query nova via api
curl http://192.168.1.61/compute/v2.1/servers -H "x-auth-token: $T" | python3 -m json.tool
 

# some common list and show commands
# the openstack command is sort of a wrapper for commands native to the modules
openstack server list --fit-width
openstack network list
openstack flavor list
openstack image list
openstack server show SERVER
openstack server stop SERVER
openstack server start SERVER
openstack server delete SERVER *deletes disk
openstack console log show
openstack console url show
openstack help server *for managing instances
openstack help server create *help for all commands
nova flavor-list
glance image-list
neutron net-list

# list parts of nova, requires admin
openstack compute service list

# create and view a server
openstack server create --image cirros --flavor 1 --network private myinstance
openstack console url show SERVER
openstack console log show SERVER

# add and manage security groups
openstack security group create NAME
openstack security group rule create --dst-port XX --protocol tcp NAME
openstack server add security group SERVER SECGROUP
openstack server remove security group SERVER SECGROUP
openstack security group list --fit-width -f yaml --long *foramt yaml may be easier to read *long shows direction
openstack security group rule list NAME --long

# manage floating IPs
# these are 'public' IPs or IPs on the network configured as 'public'
openstack floating ip list
openstack floating ip create EXT_NET
openstack server add floating ip SERVER_IP
openstack server remove floating ip SERVER_IP
openstack floating ip delete IP_ADDR

# manage key pairs
openstack keypair create NAME >key.pem
chmod 600 key.pem
openstack keypair create --public-key key.pub *add existing pub key
openstack keypair show --public-key NAME
openstack keypair list
openstack server create ... --key-name NAME
openstack keypair create KEY_NAME > MY_KEY.pem

# metadata properties
openstack server create --property db=10.100.100.6 *key value pair *can be used multiple times
openstack server create    --user-data install.sh *execute a script
openstack server create --user-data FILE *cloud-config file
openstack server create ... --config-drive=true *looks like a cdrom to the VM


# manage networks
openstack network create NETWORK
openstack subnet create NETWORK-subnet --network NETWORK --subnet range x.x.x.x
openstack network set --name OLD NEW
 

# DNS needs to be configured on subnet
openstack subnet set SUBNET --dns-nameserver=1.1.1.1 --host-route destination=IP,gateway=IP

# manage routers
openstack router create ROUTER
openstack router add subnet ROUTER SUBNET
openstack router set --external-gateway public
openstack router create ROUTER
openstack router add subnet ROUTER SUBNET
openstack router add subnet ROUTER SUBNET2

# manage individual ports
openstack port create PORT_NAME --network NETWORK
openstack router add port PORT_NAME ROUTER


# add an image to use with VMs
openstack image create --disk-format qcow2 --container-format bare \
  --public --file ./centos63.qcow2 centos63-image

# snapshot / create Image
openstack server image create SERVER --name IMAGE_NAME

Comments

Popular Posts