Kolla-Ansible is a powerful tool for deploying OpenStack in a containerized manner. It utilizes Docker containers and Ansible automation technology to help you quickly set up a production-grade OpenStack cloud platform.
Below, I will outline the core steps for deployment, key configurations, and some practical suggestions.
📦Understanding the Advantages of Kolla-Ansible
The main reasons for choosing Kolla-Ansible are its outstanding performance in the following areas:
- Containerized Deployment: All OpenStack services run in Docker containers, achieving excellent environment isolation, rapid deployment, and supporting smooth upgrades or rollbacks.
- Automation and Reliability: Utilizing Ansible for automated orchestration reduces manual operation errors, making the deployment process more reliable.
- Community Support: As an official project of the OpenStack community, Kolla-Ansible has good community support and continuous updates and maintenance.
🛠️Preparation Before Deployment
System Requirements
Before starting, please ensure that your target machine (which can be a physical or virtual machine) meets the following basic conditions:
|
Item |
Minimum/Recommended Configuration |
Description |
|
Operating System |
CentOS 7/8/9, Rocky Linux, Ubuntu 18.04+ |
Must be a supported Kolla-Ansible Linux distribution. For example, there are reports of deploying the Yoga version on Rocky 8.6 , and there are also cases of deploying the Rocky version on Ubuntu 18.04 . |
|
CPU/Memory |
At least 4 cores CPU, 8GB memory |
All-in-One (single-node) deployments are also recommended to be configured no lower than this; the more resources, the better. |
|
Disk Space |
The system disk must have at least40GB |
If you need to enable Cinder block storage service, additional disk space must be prepared for storage volumes. |
|
Network |
At least two network interfaces |
One for management/API network (usually has an IP address), and another for Neutron external network (usually not configured with an IP). |
|
Virtualization |
Support for KVM (recommended) or QEMU |
It is recommended to use KVM for better performance on physical machines; testing in virtual machines usually requires setting to QEMU. |
System Initialization
- Disable SELinux and the firewall: To avoid permission and access issues, it is generally recommended to disable SELinux and the firewall in deployment and testing environments.
bash
# Disable SELinux (effective after reboot)
sudo setenforce 0
sudo sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/g’ /etc/selinux/config
# Stop and disable the firewall (Firewalld)
sudo systemctl stop firewalld
sudo systemctl disable firewalld
- Configure the hostname and hosts file: Set the correct hostname for the node and ensure that the hostname can be correctly resolved to the management network’s IP address in /etc/hosts .
bash
# Set the hostname, for example, set it to ‘controller’
sudo hostnamectl set-hostname controller
# Bind the hostname to the management IP, for example, echo “192.168.41.13 controller” | sudo tee -a /etc/hosts
- Configure SSH passwordless login: Although single-node deployments (ansible_connection=local) may not require this, multi-node deployments need to configure passwordless SSH login from the deployment node to all target nodes.
🚀Core Deployment Steps
Phase One: Install Dependencies and Kolla-Ansible
- Install system dependencies:
bash
# For CentOS/Rocky Linux and other RHEL-based systems
sudo dnf install -y python3-devel libffi-devel gcc openssl-devel python3-libselinux libvirt-devel
# Or use yum (for older versions)
# For Ubuntu
sudo apt-get update
sudo apt-get install -y python3-dev libffi-dev gcc libssl-dev
- Create a Python virtual environment (recommended): Using a virtual environment can avoid Python package version conflicts.
bash
python3 -m venv /path/to/your/venv # For example, /root/venv or /home/username/kolla-venv
source /path/to/your/venv/bin/activate
- Upgrade pip and install Ansible, Kolla-Ansible:
bash
pip install -U pip
# Install a specific version of Ansible, for example, pip install ‘ansible>=4,<6’:cite[1] or ‘ansible-core>=2.15,<2.16.99’:cite[6]
pip install ‘ansible>=4,<6’
# Install a specific version of Kolla-Ansible, for example, pip install kolla-ansible==14.0.0 (corresponding to Yoga):cite[1]
# Or install directly from the stable branch, for example, pip install git+https://opendev.org/openstack/kolla-ansible@stable/2024.1:cite[6]
pip install kolla-ansible
- Copy configuration files:
bash
sudo mkdir -p /etc/kolla
sudo chown $USER:$USER /etc/kolla
cp -r /path/to/venv/share/kolla-ansible/etc_examples/kolla/* /etc/kolla/
cp /path/to/venv/share/kolla-ansible/ansible/inventory/* .
Phase Two: Configure Kolla-Ansible
- Configure Ansible: Create or modify /etc/ansible/ansible.cfg and add the following basic configurations to optimize the experience.
ini
[defaults]
host_key_checking = False
pipelining = True
forks = 100
- Edit the global configuration file /etc/kolla/globals.yml: This is the most critical configuration step. Below is an example of key configurations for an All-in-One deployment.
yaml
# Basic Configuration
kolla_base_distro: “centos” # or “rocky”, “ubuntu”
kolla_install_type: “binary” #or “source”, usually use binary
openstack_release: “yoga” # Specify the version of OpenStack you want to deploy, such as 2024.1, yoga, wallaby , etc.
# Network Configuration – Modify according to your actual network interface names
network_interface: “ens33” # Management network interface (e.g., the network card used for SSH connections)
neutron_external_interface: “ens34” # External network interface (for virtual machine access to the internet)
kolla_internal_vip_address: “192.168.41.13”# Management network’s VIP, can be set to the management network card’s IP:cite[1]:cite[8]
# Neutron Network Plugin
neutron_plugin_agent: “openvswitch”
# Service Enablement Configuration – Enable as needed
enable_haproxy: “no” # Can disable HAProxy for single-node deployments:cite[1]:cite[3]:cite[8]
enable_cinder: “yes” # Enable block storage service
enable_cinder_backend_lvm: “yes” #Enable LVM backend for Cinder
cinder_volume_group: “cinder-volumes”#Volume group name that needs to be created in advance:cite[4]:cite[6]
# Virtualization Type
nova_compute_virt_type: “qemu” #Use “qemu” when deploying in virtual machines or when physical machines do not support KVM
- Prepare LVM for Cinder (if enabled):
bash
# Assuming the disk device prepared for Cinder is /dev/sdb
sudo pvcreate /dev/sdb
sudo vgcreate cinder-volumes /dev/sdb
- Configure the Inventory file: For All-in-One deployments, modify the all-in-one inventory file to set all nodes under each group to local connection.
ini
[control]
localhost ansible_connection=local
[network]
localhost ansible_connection=local
[compute]
localhost ansible_connection=local
[storage]
localhost ansible_connection=local
[monitoring]
localhost ansible_connection=local
[deployment]
localhost ansible_connection=local
- Generate password file:
bash
kolla-genpwd
All service passwords will be generated in /etc/kolla/passwords.yml. You can modify the keystone_admin_password in it before deployment to set the OpenStack admin password.
Phase Three: Execute Deployment
- Bootstrap Target Servers: Install necessary system packages and configurations.
bash
kolla-ansible -i all-in-one bootstrap-servers
- Perform Pre-checks: Check if the environment meets deployment requirements.
bash
kolla-ansible -i all-in-one prechecks
- Pull Docker Images (optional but recommended): Pulling images in advance can speed up deployment.
bash
kolla-ansible -i all-in-one pull
- Start Deployment: This is the most time-consuming step.
bash
kolla-ansible -i all-in-one deploy
- Post-deployment Configuration:
bash
# Generate admin authentication file
kolla-ansible post-deploy
# Load environment variables
source /etc/kolla/admin-openrc.sh
# Install OpenStack command-line client
pip install python-openstackclient
🧪Verification and Initial Use
After successful deployment, you can perform the following actions:
- Check Container Status: Run docker ps to see if all OpenStack service containers are running normally.
- Access Horizon Dashboard: Enter the management network’s IP or VIP address in the browser, and log in using the keystone_admin_password corresponding to the password in /etc/kolla/passwords.yml with the admin user.
- Use Command Line: Execute openstack token issue, if it successfully returns token information, it indicates that the CLI is configured correctly.
- Create Sample Network and Instance (optional): You can run source /path/to/venv/share/kolla-ansible/init-runonce to create a demonstration environment.
💡Notes and Troubleshooting
- Version Compatibility: Ensure that the openstack_release configuration is compatible with the version of kolla-ansible you installed.
- Network Interface Configuration: The network interface specified by neutron_external_interface should not be configured with an IP address, otherwise it may affect the virtual machine network.
- Insufficient Resources: When deployment or virtual machine creation fails, check if there is sufficient disk space and memory.
- Check Logs: If a service fails to start, you can use the docker logs <container_name> command to view the corresponding container’s logs to locate the issue.
- Redeploy: If deployment fails, you can first run kolla-ansible -i all-in-one destroy to clean up the environment, and then re-execute the deployment steps.
💎Summary
Kolla-Ansible significantly simplifies the deployment and maintenance of OpenStack through containerization and automation. The key lies in carefully preparing the environment, correctly editing the /etc/kolla/globals.yml configuration file, and following the standard deployment process.
I hope this guide helps you successfully set up your OpenStack cloud platform! If you encounter issues during specific steps, such as a service failing to start, you can refer to the container’s log information.
#OpenStack
#Ansible
#CloudPlatform