Getting Started with SysEleven OpenStack
Installing and Configuring OpenStack CLI
Please refer to OpenStack API Access for details on how to install and configure the OpenStack CLI.
Provisioning a Simple Server and Giving It Access to the Internet
To get started with SysEleven OpenStack, follow these steps:
1. Create a Network and Subnet
- Use the sidebar to navigate to Networks.
- Click Create in the list view and fill out the form:
- Name: Provide a name for your network (e.g.,
my-network). - Description: Optionally, add a description. - Ensure the Create Subnet option is toggled on to create a subnet alongside the network. - Subnet Details:- Subnet Name: Give a name to your subnet (e.g.,
my-subnet). - Network Address: Specify the IP range for your subnet (e.g.,
192.168.1.0/24).
- Subnet Name: Give a name to your subnet (e.g.,
- Click Create. Your network and subnet will be available immediately.
Use the openstack commands to create a network and subnet.
Define your network and subnet resources in your Terraform configuration.
resource "openstack_networking_network_v2" "my_network" {
name = "my-network"
admin_state_up = true
}
resource "openstack_networking_subnet_v2" "my_subnet" {
name = "my-subnet"
network_id = openstack_networking_network_v2.my_network.id
cidr = "192.168.1.0/24"
ip_version = 4
dns_nameservers = ["8.8.8.8", "8.8.4.4"]
}
2. Create an SSH Key
- Use the sidebar to navigate to SSH Keys.
- Click Create and choose to: - Generate a Key Pair: The system will generate a new key pair for you. - Import Public Key: Use an existing public key from your local machine.
- Name your key (e.g.,
my-key). - Click OK. Your SSH key will be available immediately.
Use the openstack command to create or import an SSH key.
3. Provision a Server
- Navigate to Servers in the sidebar.
- Click Create and fill out the necessary details:
- Basics:
- Name: Provide a name for your server (e.g.,
my-server). - Description: Optionally, add a description.
- Flavor: Select the desired flavor (e.g.,
m1.small). - Source:
- Choose an image to boot from (e.g.,
Ubuntu 20.04). - Networks:
- Attach your server to the network you created earlier (e.g.,
my-network). - Key Pair:
- Select the SSH key you created (e.g.,
my-key).
- Name: Provide a name for your server (e.g.,
- Click Create to start provisioning your server.
Use the openstack command to create a server.
Define a compute instance resource in your Terraform configuration.
# Fetch the latest Ubuntu image
data "openstack_images_image_v2" "ubuntu" {
name = "Ubuntu 20.04"
}
# Fetch the desired flavor
data "openstack_compute_flavor_v2" "small" {
name = "m1.small"
}
resource "openstack_compute_instance_v2" "my_instance" {
name = "my-server"
image_id = data.openstack_images_image_v2.ubuntu.id
flavor_id = data.openstack_compute_flavor_v2.small.id
key_pair = openstack_compute_keypair_v2.my_keypair.name
security_groups = ["default"]
network {
uuid = openstack_networking_network_v2.my_network.id
}
}
4. Associate a Floating IP (Optional for Internet Access)
To allow external access to your server, associate a floating IP.
- Navigate to the "Floating IPs" section in the UI.
- Click "Allocate IP to Project" to create a new floating IP.
- Select the newly created floating IP and choose "Associate" from the actions menu.
- In the dialog, select your server and click "Associate".
To allow external access to your server, associate a floating IP.
# Allocate a floating IP from the 'public' network
openstack floating ip create public
# List available floating IPs to get the allocated IP address
openstack floating ip list
# Associate the floating IP with your server
openstack server add floating ip my-server <floating-ip-address>
Replace <floating-ip-address> with the actual floating IP you allocated.
Include resources to create and associate a floating IP in your Terraform configuration.
# Allocate a floating IP
resource "openstack_networking_floatingip_v2" "fip" {
pool = "public"
}
# Associate the floating IP with your server
resource "openstack_compute_floatingip_associate_v2" "fip_assoc" {
floating_ip = openstack_networking_floatingip_v2.fip.address
instance_id = openstack_compute_instance_v2.my_instance.id
}
5. Accessing Your Server
Once your server is running and has a floating IP, you can SSH into it.
Once your server is running and has a floating IP associated:
- Navigate to the "Servers" section in the UI.
- Find your server in the list and note its floating IP address.
- Use an SSH client to connect to the server:
- On Linux or macOS, open a terminal and use the
sshcommand. - On Windows, you can use PuTTY or the built-in OpenSSH client in newer versions.
Example SSH command:
Replace <floating-ip-address> with your server's actual floating IP, and adjust the username (e.g., ubuntu) based on the image you used.
Once your server is running and has a floating IP associated, you can SSH into it using the OpenStack CLI:
# Get the floating IP of your server
FLOATING_IP=$(openstack server show my-server -f value -c addresses | grep -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+')
# SSH into the server
ssh -i path/to/your/private-key.pem ubuntu@$FLOATING_IP
Replace path/to/your/private-key.pem with the path to your private key file, and adjust the username (ubuntu) if necessary based on the image you used.
After applying your Terraform configuration and associating a floating IP, you can output the IP address and use it to SSH into your server:
# Output the floating IP
output "server_floating_ip" {
value = openstack_networking_floatingip_v2.fip.address
}
After running terraform apply, you'll see the floating IP in the output. Use this IP to SSH into your server:
Replace <output-floating-ip> with the IP address from the Terraform output, and adjust the username (ubuntu) if necessary based on the image you used.
Summary
By following these steps, you've:
- Created a network and subnet.
- Generated or imported an SSH key.
- Provisioned a server attached to your network.
- (Optionally) Associated a floating IP for external access.
- Connected to your server via SSH.
Your server is now ready for use!
Additional Tips
Security Groups
Ensure your security group rules allow SSH access (port 22) from your IP.
- Navigate to the "Security Groups" section.
- Select the security group associated with your server.
- Click "Add Rule" and create a rule allowing inbound TCP traffic on port 22.
Floating IP Pool
The external network name (public in this example) may vary. Use openstack network list --external to find the correct name.
Cleanup
Remember to delete resources when they're no longer needed to avoid unnecessary charges.
Navigate through the UI to delete each resource (servers, floating IPs, networks, etc.) when no longer needed.
Simply run terraform destroy to remove all resources defined in your Terraform configuration.
Troubleshooting
- SSH Permission Denied: Ensure your private key has correct permissions (
chmod 600 my-key.pem) and you're using the correct username. - Resource Quotas: If you encounter quota issues, you may need to request quota increases from SysEleven support.
- Security Group Rules: Double-check that your security groups allow the necessary ingress and egress traffic.