Using Custom Config in Kolla-Ansible

Kolla Mascot

The previous article introduced how to deploy OpenStack using Kolla and Kolla-Ansible.. All configurations are still set in globals.yml , while others are handled by templates in Kolla-Ansible. However, this approach inevitably lacks some flexibility during deployment, making it impossible to customize for specific environments. Thus, the config override method was born for custom configuration. This article will introduce how to use config override to modify the configuration files of OpenStack deployed by Kolla-Ansible.

Configuration Method

Similarly, in globals.yml` 中我們可以找到一行設定 config overrides 檔案的資料夾。預設值是 `/etc/kolla/config , you can change it to your desired folder.

# Location of configuration overrides
#node_custom_config: "/etc/kolla/config"

Kolla-Ansible will look for files in /etc/kolla/config/<< 服務名稱 >>/<< 設定檔 >> . Configuration overrides can basically override an entire OpenStack project (e.g., Nova), an OpenStack service (e.g., nova-api), or a service on a specific host (e.g., nova-api on controller02), which is very flexible to use.

Additionally, if you want to override settings for all services, Kolla-Ansible will look for /etc/kolla/config/global.conf this file.

Configuration Examples

If you want to enable nested virtualization on OpenStack Virtual Machines, we need to set the cpu_mode in libvirt parameters to host-passthrough.
At this point, you will need to create a new /etc/kolla/config/nova/nova-compute.conf and then write the following two lines:

[libvirt]
cpu_mode=host-passthrough

If you want to change the CPU and RAM allocation ratios on the host compute01, you would create /etc/kolla/config/nova/compute01/nova-compute.conf and write:

[DEFAULT]
cpu_allocation_ratio = 16.0
ram_allocation_ratio = 2.0

Finally, if you want to change the database connection pool size for all services, you would create a new /etc/kolla/config/global.conf Write to file

[database]
max_pool_size = 100

Policy Configuration

The configuration method for policy.json is slightly different from standard service configuration files; you must place the complete policy file within the corresponding project folder. Kolla-Ansible will then use that file to override the default policy.json.

For example, to override Neutron's policy.json, the deployer needs to obtain the complete policy.json from the Neutron source code, modify it, and place it /etc/kolla/config/neutron/policy.json under.

Post-Deployment Configuration Changes

Changing configurations in an already deployed OpenStack cluster is also very easy with Kolla-Ansible; you simply need to run:

kolla-ansible reconfigure

This will deploy the modified configuration files to the environment and restart the corresponding containers.

Conclusion

Through config overrides, operators can easily adjust configuration files for individual services or even specific services on a host. This makes deploying OpenStack with Kolla-Ansible more flexible, allowing for customized deployments based on specific requirements.

Reference

Kolla-Ansible Advanced Configuration


Copyright Notice: All articles on this blog are licensed under CC BY-NC-SA 4.0 unless otherwise stated.

Leave a Reply