OpenStack: Difference between revisions
From Cheatsheet
Jump to navigationJump to search
No edit summary |
|||
| Line 1: | Line 1: | ||
[[Category:Cheatsheet|Cheatsheets]] | [[Category:Cheatsheet|Cheatsheets]] | ||
== Modules == | == OpenStack CLI client == | ||
* https://docs.openstack.org/newton/user-guide/common/cli-install-openstack-command-line-clients.html | |||
* https://help.dreamhost.com/hc/en-us/articles/235817468-Getting-started-with-the-OpenStack-command-line-client | |||
* https://pip.pypa.io/en/stable/installation/ | |||
* https://docs.openstack.org/install-guide/environment-packages-rdo.html | |||
<syntaxhighlight lang="bash"> | |||
yum update | |||
yum install python3 | |||
yum install python-openstackclient | |||
python3 -m pip install --upgrade pip | |||
pip3 install python-openstackclient | |||
</syntaxhighlight> | |||
<syntaxhighlight lang="bash"> | |||
# Source the OpenRC you configured/downloaded from the Horizon dashboard | |||
source Tenant-openrc-new.sh | |||
# Issue a token | |||
openstack token issue | |||
</syntaxhighlight> | |||
== Common == | |||
=== Commands === | |||
<syntaxhighlight lang="bash"> | |||
# Enter OpenStack interactive mode | |||
openstack | |||
# Leave OpenStack interactive mode | |||
exit | |||
# Show all OpenStack commands and parameters | |||
openstack --help | |||
# Show all OpenStack commands and parameters relating to the "server" parameter | |||
openstack --help server | |||
</syntaxhighlight> | |||
=== Checks === | |||
Some of these checks require an OpenStack admin OpenRC. | |||
<syntaxhighlight lang="bash"> | |||
# List all compute nodes | |||
openstack compute service list | |||
# List all network-devices used by the compute nodes | |||
openstack network agent list | |||
# List all storage-devices/enclosures | |||
openstack volume service list | |||
# List all users | |||
openstack user list | |||
# List all projects | |||
openstack project list | |||
# List all images | |||
openstack image list | |||
# Show resource-usage per hour for a month, for each project | |||
openstack usage list | |||
# List all available Flavors | |||
openstack flavor list --all | |||
# Show specific Flavor information | |||
openstack flavor show m1.small | |||
# Show all OpenStack VMs | |||
openstack server list --all | |||
# Show information of a specific VM | |||
openstack server show as8d7as98d-aisd7-as7d86-a7s6d-asdas789d6a987d | |||
</syntaxhighlight> | |||
== Modules - CLI == | |||
=== Nova === | |||
<syntaxhighlight lang="bash"> | |||
# Deploy a CD-based Instance | |||
nova boot --flavor c2r4 --nic net-id=asd897-as987d6-as789d-as8d76-as8d67 --block-device id=as7das90d-asd867as89d6sa9-7a6sd78as6d78,source=image,dest=volume,bus=usb,device=/dev/vdb,size=5,type=cdrom,bootindex=0 MyInstance | |||
</syntaxhighlight> | |||
=== Glance === | === Glance === | ||
Tenant example: '''as8d76asd976ds798a6d78sa95das7968d5as978''' </br> | Tenant example: '''as8d76asd976ds798a6d78sa95das7968d5as978''' </br> | ||
| Line 12: | Line 94: | ||
# Set an Image owner to a specific project | # Set an Image owner to a specific project | ||
openstack image set as7das90d-asd867as89d6sa9-7a6sd78as6d78 --project as8d76asd976ds798a6d78sa95das7968d5as978 | openstack image set as7das90d-asd867as89d6sa9-7a6sd78as6d78 --project as8d76asd976ds798a6d78sa95das7968d5as978 | ||
# Set an image to Private | |||
openstack image set as7das90d-asd867as89d6sa9-7a6sd78as6d78 --private | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 17:32, 31 July 2023
OpenStack CLI client
- https://docs.openstack.org/newton/user-guide/common/cli-install-openstack-command-line-clients.html
- https://help.dreamhost.com/hc/en-us/articles/235817468-Getting-started-with-the-OpenStack-command-line-client
- https://pip.pypa.io/en/stable/installation/
- https://docs.openstack.org/install-guide/environment-packages-rdo.html
yum update yum install python3 yum install python-openstackclient python3 -m pip install --upgrade pip pip3 install python-openstackclient
# Source the OpenRC you configured/downloaded from the Horizon dashboard source Tenant-openrc-new.sh # Issue a token openstack token issue
Common
Commands
# Enter OpenStack interactive mode openstack # Leave OpenStack interactive mode exit # Show all OpenStack commands and parameters openstack --help # Show all OpenStack commands and parameters relating to the "server" parameter openstack --help server
Checks
Some of these checks require an OpenStack admin OpenRC.
# List all compute nodes openstack compute service list # List all network-devices used by the compute nodes openstack network agent list # List all storage-devices/enclosures openstack volume service list # List all users openstack user list # List all projects openstack project list # List all images openstack image list # Show resource-usage per hour for a month, for each project openstack usage list # List all available Flavors openstack flavor list --all # Show specific Flavor information openstack flavor show m1.small # Show all OpenStack VMs openstack server list --all # Show information of a specific VM openstack server show as8d7as98d-aisd7-as7d86-a7s6d-asdas789d6a987d
Modules - CLI
Nova
# Deploy a CD-based Instance nova boot --flavor c2r4 --nic net-id=asd897-as987d6-as789d-as8d76-as8d67 --block-device id=as7das90d-asd867as89d6sa9-7a6sd78as6d78,source=image,dest=volume,bus=usb,device=/dev/vdb,size=5,type=cdrom,bootindex=0 MyInstance
Glance
Tenant example: as8d76asd976ds798a6d78sa95das7968d5as978
Image example: as7das90d-asd867as89d6sa9-7a6sd78as6d78
# List all available images for the current Tenant openstack image list # Set an Image owner to a specific project openstack image set as7das90d-asd867as89d6sa9-7a6sd78as6d78 --project as8d76asd976ds798a6d78sa95das7968d5as978 # Set an image to Private openstack image set as7das90d-asd867as89d6sa9-7a6sd78as6d78 --private
Image sharing
# From the Image owners' OpenRC openstack image add project as7das90d-asd867as89d6sa9-7a6sd78as6d78 as8d76asd976ds798a6d78sa95das7968d5as978 # Verify status of the shared image openstack image member list as7das90d-asd867as89d6sa9-7a6sd78as6d78 # Source the receiving Tenant's OpenRC # Accept the image openstack image set --accept as7das90d-asd867as89d6sa9-7a6sd78as6d78 # Stop sharing from the owners' OpenRC openstack image remove project as7das90d-asd867as89d6sa9-7a6sd78as6d78 as8d76asd976ds798a6d78sa95das7968d5as978
Magnum
Magnum is used to create Kubernetes clusters.
# Check the Tenants' Overview tab to verify sufficient Quota has been assigned for the new nodes. # Source the relevant OpenRC file. # Create a Magnum template. openstack coe cluster template create --coe kubernetes --image fedora-coreos-36 --external-network Internet-network --network-driver flannel --dns-nameserver 1.1.1.1 --master-flavor c2r4 --flavor c2r4 --docker-storage-driver overlay2 MyTemplate-v1.00 # Deploy cluster based on previously created template. openstack coe cluster create --cluster-template MyTemplate-v1.00 --keypair MyKeyPair-2023 --master-count 1 --node-count 2 --master-flavor c1r4 --flavor c2r4 --fixed-network Tenant-Tnternal-Network --fixed-subnet Tenant-Tnternal-Network_Subnet --floating-ip-disabled MyClusterName-v1.00