深入了解kolla实现,以及更改docker的一些配置。
Kolla
- Kolla的配置文件都存放在
/etc/kolla/
,当容器启动时,会读取这里的配置。 - Kolla-ansible则提供了类似模板的办法去修改配置文件,并分发到各个node上。
An operator can change the location where custom config files are read from by editing /etc/kolla/globals.yml and adding the following line.
The directory to merge custom config files the kolla’s config files
node_custom_config: “/etc/kolla/config”
Kolla allows the operator to override configuration of services. Kolla will look for a file in /etc/kolla/config/<< service name >>/<< config file >>. This can be done per-project, per-service or per-service-on-specified-host.
If the operator wants to configure compute node cpu and ram allocation ratio on host myhost, the operator needs to create file /etc/kolla/config/nova/myhost/nova.conf with content:
Kolla allows the operator to override configuration globally for all services. It will look for a file called /etc/kolla/config/global.conf.
For example to modify database pool size connection for all services, the operator needs to create /etc/kolla/config/global.conf with content:
Overcommitting
尝试修改Openstack overcommitting参数,实际上默认值已经超卖了资源,cpu 16:1,memory 1.5:1。
nova-scheduler.conf
1
2
3[DEFAULT]
cpu_allocation_ratio = 2.0
enabled_filters = AggregateInstanceExtraSpecsFilter, RetryFilter, AvailabilityZoneFilter, RamFilter, DiskFilter, ComputeFilter, ComputeCapabilitiesFilter, ImagePropertiesFilter, ServerGroupAntiAffinityFilter, ServerGroupAffinityFilter, CoreFilter
Docker
kolla的持久化文件,都在docker根目录下的
volumes
,很容易就能看懂。虚拟机就是
volumes/nova_compute/_data/instances
。因此,docker根目录的磁盘空间要足够,最好的办法是直接mount一块区域给
/var/lib/docker
。但我们已经分配好了所有的磁盘,并且都是xfs,调整并不方便。
先停止docker daemon,将根目录迁移,然后创建一个soft link,完成偷梁换柱。
1
2mv /var/lib/docker /home/lib/docker
link -s /home/lib/docker /var/lib/docker