2021/5/26
Ubuntu Install Ussuri OpenStack By Kolla
机器要求
4块网卡
8GB 内存+
40GB系统盘
一、前期工作
1.修改apt源
sudo mv /etc/apt/sources.list /etc/apt/sourses.list.backup
sudo vim /etc/apt/sources.list
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
更新源
apt update
修改hostname
2.安装依赖包
三个节点执行
sudo apt-get install python3-dev libffi-dev gcc libssl-dev -y
sudo apt-get install python3-pip -y
pip3 install docker
3. pip加速
mkdir ~/.pip
cat > ~/.pip/pip.conf
[global]
trusted-host=mirrors.aliyun.com
index-url=https://mirrors.aliyun.com/pypi/simple/
4. 在第一个节点用venv安装ansible, kolla-ansible
第一个节点作为deployment server
sudo apt install python3-venv -y
python3 -m venv multinode-venv
source multinode-venv/bin/activate
pip install -U pip
pip install 'ansible<2.10'
git config --global user.name username
git config --global user.password password
git config --global user.email email
git clone https://github.com/openstack/kolla-ansible
or
git clone git@github.com:openstack/kolla-ansible.git
cd kolla-ansible/
git checkout remotes/origin/stable/ussuri
git checkout -b ussuri
cd ..
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/* .
5. 配置ansible参数
mkdir /etc/ansible
cat > /etc/ansible/ansible.cfg
[defaults]
host_key_checking=False
pipelining=True
forks=100
6. 修改globals.yaml文件
kolla_base_distro: "ubuntu"
kolla_install_type: "source"
openstack_release: "ussuri"
kolla_internal_vip_address: "vip"
network_interface: "ens3"
neutron_external_interface: "ens12"
neutron_plugin_agent: "openvswitch"
keepalived_virtual_router_id: "70"
enable_cinder: "yes"
enable_cinder_backup: "no"
enable_cinder_backend_lvm: "yes"
enable_neutron_provider_networks: "yes"
cinder_volume_group: "cinder-volumes"
7. 对接ceph
文档详见: kolla-ansible/blob/master/doc/source/reference/storage/external-ceph-guide.rst
配置外部ceph,使用kolla的合并配置特性,对相应的组件的ceph存储pool池进行配置。
在ceph集群中创建nova、glance、cinder(cinder-volumes/cinder-backup)等组件使用ceph的用户并生产keyring文件
拷贝配置文件及keying文件,修改globals.yml
# cat /etc/kolla/globals.yml
enable_openstack_core: "yes"
enable_heat: "no"
kolla_base_distro: "ubuntu"
kolla_install_type: "source"
openstack_release: "ussuri"
kolla_internal_vip_address: "vip"
network_interface: "ens3"
neutron_external_interface: "ens12"
neutron_plugin_agent: "openvswitch"
keepalived_virtual_router_id: "70"
enable_neutron_provider_networks: "yes"
enable_cinder: "yes"
enable_cinder_backup: "no"
enable_cinder_backend_lvm: "no"
#Cinder
cinder_backend_ceph: "yes"
ceph_cinder_keyring: "ceph.client.admin.keyring"
ceph_cinder_user: "admin"
ceph_cinder_pool_name: "volumes"
# Glance
glance_backend_ceph: "yes"
ceph_glance_keyring: "ceph.client.admin.keyring"
ceph_glance_user: "admin"
ceph_glance_pool_name: "images"
# Nova
nova_backend_ceph: "yes"
ceph_nova_keyring: "ceph.client.admin.keyring"
ceph_nova_user: "admin"
ceph_nova_pool_name: "compute"
nova_compute_virt_type: "qemu"
8. 若使用LVM需要创建卷组(所有节点执行)
pvcreate /dev/vdb
vgcreate cinder-volumes /dev/vdb
9. 修改multinode
修改以下几个
[control]
controller1
controller2
controller3
[network]
controller1
controller2
controller3
[compute]
controller1
controller2
controller3
[monitoring]
controller1
controller2
controller3
[storage]
controller1
controller2
controller3
10. 设置root免密
sudo vi /etc/ssh/sshd_config
修改:
#PermitRootLogin prohibit-password
PermitRootLogin yes
重启
sudo service ssh restart
然后ssh-keygen ssh-copy-id ..................
//测试
ansible -i multinode all -m ping
11.生成密码
kolla-genpwd
到/etc/kollla/password修改密码(keystone_admin_password 登录dashboard的密码)
database_password: yourpassword
keystone_admin_password: admin
12.执行kolla
kolla-ansible -i multinode bootstrap-servers
kolla-ansible -i multinode prechecks
kolla-ansible -i multinode pull
kolla-ansible -i multinode deploy
13. 使用&验证
kolla-ansible -i multinode post-deploy
apt install python-openstackclient -y
source /etc/kolla/admin.rc
init-runonce
修改keepalived(默认配置会脑裂)
在 kolla-ansible -i multinode deploy 执行到keepalived时,快速在三节点keepalived加上以下配置
vim /usr/local/share/kolla-ansible/ansible/roles/haproxy/templates/keepalived.conf.j2
unicast_src_ip 本机ip
unicast_peer {
controller2_ip
controller3_ip
}
14. others
重新配置容器组件:`kolla-ansible -i multinode reconfigure -t nova`
清理kolla ansible集群:`kolla-ansible destroy --include-images --yes-i-really-really-mean-it`
停止部署节点容器,mysql容易出问题:`kolla-ansible stop`
or
[root@kolla ~]# cd /usr/share/kolla-ansible/tools/
[root@all tools]# ./cleanup-containers
[root@all tools]# ./cleanup-host