Deploy ceph
The ussuri version no longer supports deploying ceph through kolla, and you need to use external ceph, see
https://blog.51cto.com/penguintux/2536500,
first deploy a set of ceph,
see
https://docs.openstack.org/kolla-ansible/ussuri /reference/storage/external-ceph-guide.htmlConfigure
external ceph
Prepare ceph
- Create pool
ceph osd pool create volumes
ceph osd pool create images
ceph osd pool create backups
ceph osd pool create vms
rbd pool init volumes
rbd pool init images
rbd pool init backups
rbd pool init vms
- Create keyring
ceph auth get-or-create client.glance mon 'profile rbd' osd 'profile rbd pool=images' mgr 'profile rbd pool=images' -o /etc/ceph/ceph.client.glance.keyring ceph auth get-or-create client.cinder mon 'profile rbd' osd 'profile rbd pool=volumes, profile rbd pool=vms, profile rbd-read-only pool=images' mgr 'profile rbd pool=volumes, profile rbd pool=vms' -o /etc/ceph/ceph.client.cinder.keyring ceph auth get-or-create client.cinder-backup mon 'profile rbd' osd 'profile rbd pool=backups' mgr 'profile rbd pool=backups' -o /etc/ceph/ceph.client.cinder-backup.keyring
The component version of kolla-ansible
cat kolla-ansible/ansible/roles/prechecks/vars/main.yml
---
docker_version_min: '1.10.0'
docker_py_version_min: '2.0.0'
ansible_version_min: '2.8'
ansible_version_max: '2.9'
Prepare CentOS 8 environment
- Prepare virtualven environment
yum install python3
pip3 install docker
python3 -m venv /opt/ven_op
source /opt/ven_op/bin/activate
- Use domestic pip source
cat .pip/pip.conf
[global]
index-url = https://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
- Update pip
source /opt/ven_op/bin/activate pip install pip -U
-
Install Ansible
Kolla Ansible requires at least Ansible 2.8 and supports 2.9source /opt/ven_op/bin/activate pip install 'ansible<2.10'
- Install docker
cat <<EOF>> /etc/yum.repos.d/docker-ce.repo
[docker-ce-stable]
name=Docker CE Stable - $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/8/$basearch/stable
enabled=1
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
EOF
yum install docker-ce
systemctl start docker
systemctl enable docker
- Enable nested virtualization
cat <<EOF>>/etc/modprobe.d/kvm.conf options kvm_intel nested=1 EOF
Prepare kolla-ansible
- Download kolla-ansible
git clone https://github.com/openstack/kolla-ansible
- Install kolla-ansible
cd kolla-ansible
git checkout stable/ussuri
pip install .
mkdir -p /etc/kolla
chown $USER:$USER /etc/kolla
cp -r etc/kolla/* /etc/kolla/ # 实际只是复制了globals.yml、passwords.yml
Configure ansible
cat <<EOF>>/etc/ansible/ansible.cfg
[defaults]
host_key_checking=False
pipelining=True
forks=100
EOF
Configure kolla-ansible
- Generate password
kolla-genpwd
- Configure /etc/kolla/globals.yml
kolla_base_distro: "centos"
kolla_install_type: "source"
node_custom_config: "/etc/kolla/config"
# network_interface默认承载各api、vxlan、存储流量
network_interface: "eth1"
# 管理IP
# 需要与network_interface在同一网段
# 如果启用了haproxy,使用一个未被使用的IP
# 如果没启用haproxy,使用eth1的IP
kolla_internal_vip_address: "192.168.254.207"
# pulibc 网络,用于浮动IP
neutron_external_interface: "eth2"
neutron_plugin_agent: "openvswitch"
# 配置虚拟化类型
nova_compute_virt_type: "qemu"
# 要安装的组件
nable_openstack_core: "yes"
enable_haproxy: "no"
enable_cinder: "yes"
# 以下是配置使用外部ceph
glance_backend_ceph: "yes"
cinder_backend_ceph: "yes"
nova_backend_ceph: "yes"
# gnocchi_backend_storage: "ceph"
# enable_manila_backend_cephfs_native: "yes"
ceph_glance_keyring: "ceph.client.glance.keyring"
ceph_glance_user: "glance"
ceph_glance_pool_name: "images"
ceph_cinder_keyring: "ceph.client.cinder.keyring"
ceph_cinder_user: "cinder"
ceph_cinder_pool_name: "volumes"
ceph_cinder_backup_keyring: "ceph.client.cinder-backup.keyring"
ceph_cinder_backup_user: "cinder-backup"
ceph_cinder_backup_pool_name: "backups"
ceph_nova_keyring: "{{ ceph_cinder_keyring }}"
ceph_nova_user: "cinder"
ceph_nova_pool_name: "vms"
- Configure glance to use ceph
cat <<EOF>>/etc/kolla/config/glance/ceph.conf
[global]
fsid = 0e7fe350-fbbf-11ea-a78a-52540079f755
# mon_initial_members = ceph-0
mon_host = 192.168.254.200,192.168.254.201,192.168.254.202
auth_cluster_required = cephx
auth_service_required = cephx
auth_client_required = cephx
EOF
cp ceph.client.glance.keyring /etc/kolla/config/glance/
- Configure cinder to use ceph
cp /etc/kolla/config/glance/ceph.conf /etc/kolla/config/cinder
cp ceph.client.cinder.keyring /etc/kolla/config/cinder/cinder-volume/
cp ceph.client.cinder.keyring /etc/kolla/config/cinder/cinder-backup/
cp ceph.client.cinder-backup.keyring /etc/kolla/config/cinder/cinder-backup/
- Configure nova to use ceph
cp /etc/kolla/config/glance/ceph.conf /etc/kolla/config/nova
cp ceph.client.cinder.keyring /etc/kolla/config/nova/
- Configure nova
umap to enable trim
writeback to set the disk cache of the virtual machinecat <<EOF>>/etc/kolla/config/nova/nova.conf [libvirt] hw_disk_discard = unmap disk_cachemodes="network=writeback" cpu_mode=host-passthrough
Deploy openstack
- Installation dependencies
kolla-ansible -i kolla-ansible/ansible/inventory/all-in-one bootstrap-servers
- an examination
kolla-ansible -i kolla-ansible/ansible/inventory/all-in-one prechecks
-
Pull mirror
kolla-ansible -i kolla-ansible/ansible/inventory/all-in-one pull
- deploy
kolla-ansible -i kolla-ansible/ansible/inventory/all-in-one deploy
- Complete deployment
kolla-ansible post-deploy
Use openstack
pip install python-openstackclient
. /etc/kolla/admin-openrc.sha