mynote/openstack/kolla.md
2022-06-05 10:19:11 +08:00

224 lines
7.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# kolla
环境 centos7 python3.6
## 注意事项
所有节点起名不要带 . - 等特殊符号
## build image
### install
```bash
yum install -y python3 python3-pip
git clone https://github.com/openstack/kolla.git -b stable/train
cd kolla
python3 -m venv ~/kolla_venv
source ~/kolla_venv/bin/activate
# 需要几分钟 会在当前目录 生成 etc/kolla/kolla-build.conf 可以复制到 /etc/kolla
pip install --upgrade pip
pip install tox
pip install -r requirements.txt
# 该步骤需要配置外网访问环境
tox -e genconfig
```
### build
```bash
# 基本命令
kolla-build
# 在源码目录使用这个
# 在上段venv虚拟环境下
python tools/build.py
# 单独build keystone
python tools/build.py keystone --registry docker.local:5000 --push
```
## deploy
```bash
# stable/train 与ansible<10 版本冲突 有bug
git clone https://github.com/openstack/kolla.git -b 9.0.0
git clone https://github.com/openstack/kolla-ansible.git -b 9.0.0
python3 -m venv ~/kolla_venv
source ~/kolla_venv/bin/activate
# centos7 缺 utf-8 字符集
localedef -v -c -i en_US -f UTF-8 en_US.UTF-8
pip install -U pip
pip install ansible==10.2
pip install ./kolla
pip install ./kolla-ansible
sudo mkdir -p /etc/kolla
sudo chown $USER:$USER /etc/kolla
cp -r kolla-ansible/etc/kolla/* /etc/kolla
cp kolla-ansible/ansible/inventory/* .
# dowload image 该命令可以下载镜像
kolla-ansible -i ./all-in-one bootstrap-servers
kolla-ansible pull
# 生成密码
kolla-genpwd
## all-in-one
kolla-ansible -i ./all-in-one bootstrap-servers
kolla-ansible -i ./all-in-one prechecks
kolla-ansible -i ./all-in-one deploy
# 测试 连接
ansible -i multinode all -m ping
# multi_node
# bootstrap-servers 主要为安装docker-ce
vim /root/kolla_venv/share/kolla-ansible/ansible/roles/baremetal/defaults/main.yml
# 去掉docker gpg检查 断网使用
docker_yum_gpgcheck: false
enable_docker_repo: false
vim /home/parallels/kolla_venv/share/kolla-ansible/ansible/roles/prechecks/tasks/service_checks.yml
or result.stdout | regex_replace('.*\\b(\\d+\\.\\d+\\.\\d+)\\b.*', '\\1') is version(docker_version_min, '<')
kolla-ansible -i ./multinode bootstrap-servers
kolla-ansible -i ./multinode prechecks
kolla-ansible -i ./multinode deploy
```
```bash
# multinode
[control]
controller01 ansible_ssh_user=<ssh-username> ansible_become=True ansible_private_key_file=<path/to/private-key-file>
[network]
controller01
[compute]
compute-[32:33]
[monitoring]
controller01
[storage]
[deployment]
localhost ansible_connection=local
```
```bash
# vim /etc/kolla/globals.yml
kolla_install_type: "binary"
kolla_base_distro: "centos"
openstack_release: "train"
network_interface: "eth0"
# 用的是eth0 组件api网络
api_interface: "{{ network_interface }}"
#eth0作为vxlan的承载网络 虚拟机内部通信网络
tunnel_interface: "eth0"
# 网络节点指定的外部网络通信网卡, eth1作为外部网络, 该网卡不要配置ip
neutron_external_interface: "eth1"
# 该参数会在网卡network_interface上创建第二个ip地址用以组件通讯horizon也是访问该ip 注意不要和原来的ip重复
kolla_internal_vip_address: ""
# 私有docker测试时不填部署时填
docker_registry: 'docker.local:5000'
# 使用虚拟机时必须改成qemu 默认kvm
nova_compute_virt_type: "kvm"
# 不启用
enable_haproxy: "no"
enable_cinder: "yes"
# 启用cinder
# cinder后端用lvm 或者iscsi
enable_cinder_backend_lvm: "no"
enable_cinder_backend_iscsi: "yes"
cinder_volume_group: "cinder-volumes"
```
## tips
```bash
## vim /etc/ansible/ansible.cfg
## ansible.cfg (位于当前目录中)
## ~/.ansible.cfg (位于家目录中)
## /etc/ansible/ansible.cfg
## 配置文件下载
## wget https://raw.githubusercontent.com/ansible/ansible/devel/examples/ansible.cfg
## 配置ansible
host_key_checking= False
## 配置ssh
# vim /etc/ssh/ssh_config
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
```
## image list
```bash
kolla/centos-binary-keystone-fernet train 770ef6f4ef27 12 hours ago 1.04GB
kolla/centos-binary-keystone-ssh train da94b8a5b2cf 12 hours ago 1.04GB
kolla/centos-binary-nova-compute train 646ef5ceaf11 12 hours ago 1.85GB
kolla/centos-binary-keystone train 10829c9218d3 12 hours ago 1.04GB
kolla/centos-binary-glance-api train e0c8341d43c1 12 hours ago 1.05GB
kolla/centos-binary-placement-api train 35286639fad7 12 hours ago 1.05GB
kolla/centos-binary-neutron-l3-agent train c0a059499114 12 hours ago 1.08GB
kolla/centos-binary-neutron-server train fe90e2d95b6f 12 hours ago 1.08GB
kolla/centos-binary-neutron-openvswitch-agent train dc8501d31b89 12 hours ago 1.08GB
kolla/centos-binary-neutron-metadata-agent train 6c3943894297 12 hours ago 1.05GB
kolla/centos-binary-neutron-dhcp-agent train c1a532c0eb1a 12 hours ago 1.05GB
kolla/centos-binary-horizon train 01a1889c965e 12 hours ago 1.2GB
kolla/centos-binary-nova-api train e051f99ff69e 12 hours ago 1.09GB
kolla/centos-binary-nova-conductor train 181a27891c90 12 hours ago 1.05GB
kolla/centos-binary-nova-novncproxy train 10bcad23acab 12 hours ago 1.06GB
kolla/centos-binary-nova-ssh train 57e67ee7bf82 12 hours ago 1.05GB
kolla/centos-binary-nova-scheduler train 11b8f5cd4b5f 12 hours ago 1.05GB
kolla/centos-binary-heat-engine train e494e62fbee3 12 hours ago 1.08GB
kolla/centos-binary-heat-api train ea95c1de82ff 12 hours ago 1.08GB
kolla/centos-binary-heat-api-cfn train 519589193563 12 hours ago 1.08GB
kolla/centos-binary-nova-libvirt train 9928983698b2 13 hours ago 1.26GB
kolla/centos-binary-openvswitch-vswitchd train 3ef665ba3fb4 13 hours ago 428MB
kolla/centos-binary-openvswitch-db-server train 9c15e0aa5c3c 13 hours ago 428MB
kolla/centos-binary-chrony train 29818573a4cc 13 hours ago 410MB
kolla/centos-binary-kolla-toolbox train c0a499f0b02b 13 hours ago 834MB
kolla/centos-binary-haproxy train 2f400b7595d0 13 hours ago 435MB
kolla/centos-binary-keepalived train e35a4ba6008f 13 hours ago 415MB
kolla/centos-binary-mariadb train 779223d0db58 13 hours ago 594MB
kolla/centos-binary-fluentd train 2e728e1b3f53 13 hours ago 667MB
kolla/centos-binary-cron train 4ee71cc3457e 13 hours ago 409MB
kolla/centos-binary-rabbitmq train b36561201752 13 hours ago 489MB
kolla/centos-binary-memcached
```
---------------
[1]: https://docs.openstack.org/kolla/train/admin/image-building.html
[2]: https://docs.openstack.org/kolla-ansible/train/