kolla安装openstack 遵照官方文档搭建的
配置主机名
hosts绑定(/etc/hosts)
192.168.41.13 kolla
配置yum安装依赖软件
yum install https://rdoproject.org/repos/openstack-rocky/rdo-release-rocky.rpm yum install git ntp ntpdate openssh-server python-devel
下载openstack-ansible最新版本
git clone -b 21.0.0 https://git.openstack.org/openstack/openstack-ansible /opt/openstack-ansible
最新版本查看 https://docs.openstack.org/openstack-ansible/latest/
下载备用存储库
git clone -b 21.0.0 https://github.com/openstack/openstack-ansible.git /mnt/openstack-ansible
安装其他软件包
yum install bridge-utils iputils lsof lvm2 chrony openssh-server tcpdump python
添加内核模块启动vlan和接口
echo 'bonding' >> /etc/modules-load.d/openstack-ansible.conf
echo '8021q' >> /etc/modules-load.d/openstack-ansible.conf
启用时间同步
systemctl enable chronyd.service
systemctl start chronyd.service
ssh生成密钥
生成密钥参考地址 https://docs.github.com/en/github/authenticating-to-github/checking-for-existing-ssh-keys
ssh-keygen
配置网络
Container management: 172.29.236.0/22 (VLAN 10)
配置存储
pvcreate --metadatasize 2048 physical_volume_device_path
vgcreate cinder-volumes physical_volume_device_path
或者
pvcreate /dev/sdb
vgcreate cinder-volumes /dev/sdb #vg名取名为 cinder-volumes,这里主要跟 kolla配置文件里vg名一致
docker的yum源配置 参考官网 https://docs.docker.com/engine/install/centos/
配置国内pipy源
mkdir ~/.pip
cat << EOF > ~/.pip/pip.conf
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple/
[install]
trusted-host=pypi.tuna.tsinghua.edu.cn
EOF
安装pip
yum -y install epel-release
yum -y install python-pip
如果pip install 出现问题可以试试命令
pip install setuptools==33.1.1
或者
安装 pip
yum install -y python-pip
pip install -U pip -i https://mirrors.aliyun.com/pypi/simple/
python版本不兼容的问题
解决办法:
pip install --upgrade "pip < 21.0"
或者curl https://bootstrap.pypa.io/2.7/get-pip.py --output get-pip.py
解决方法二
二、安装基础包
一定要先启用EPEL的repo源
yum -y install python-devel libffi-devel gcc openssl-devel git python-pip qemu-kvm qemu-img
配置Docker共享挂载
mkdir /etc/systemd/system/docker.service.d
tee /etc/systemd/system/docker.service.d/kolla.conf << 'EOF'
[Service]
MountFlags=shared
EOF
安装 ansible
pip install -U ansible -i https://mirrors.aliyun.com/pypi/simple/
安装 kolla-ansible
pip install -U kolla-ansible -i https://mirrors.aliyun.com/pypi/simple/
或者
安装 kolla-ansible
复制相关配置文件
cp -r /usr/share/kolla-ansible/etc_examples/kolla /etc/
cp /usr/share/kolla-ansible/ansible/inventory/* /home/
或者
这里统一在/etc/kolla/ 目录下
生成密码文件
kolla-genpwd
或者
对 /etc/kolla/passwords.yml 文件生成随机密码,或者修改为自定义密码
kolla-genpwd vim /etc/kolla/passwords.yml ##admin密码可以修改为自定义,在登录dashboard会用到
keystone_admin_password: 1234qwer
登录Dashboard,admin使用的密码,你可以根据自己需要进行修改。
sed -i 's/^keystone_admin_password.*/keystone_admin_password: 1234qwer/' /etc/kolla/passwords.yml
硬盘虚拟化
openstack集群是通过virtualbox部署的,而virtualbox已经使用了kvm技术,所以需要设置nova的虚拟化为qemu,而不是kvm
cat > /etc/kolla/config/nova.conf <<EOF
[libvirt]
virt_type=qemu
cpu_mode = none
EOF
修改容器的卷类型
cat > /etc/kolla/config/magnum.conf <<EOF
[cinder]
default_docker_volume_type = iscsi
EOF
如果部署前检查报错:Hostname has to resolve to IP address of api_interface
可能需要添加一下hosts
cat >> /etc/hosts <<EOF
192.168.31.248 vm248
EOF
编辑配置文件
sed -i 's/^kolla_internal_vip_address:.*/kolla_internal_vip_address: "192.168.31.248"/' /etc/kolla/globals.yml
sed -i 's/^#openstack_release:.*/openstack_release: "train"/' /etc/kolla/globals.yml
sed -i 's/^#network_interface:.*/network_interface: "ens33"/' /etc/kolla/globals.yml
sed -i 's/^#neutron_external_interface:.*/neutron_external_interface: "ens37"/' /etc/kolla/globals.yml
sed -i 's/^#enable_haproxy:.*/enable_haproxy: "no"/' /etc/kolla/globals.yml
sed -i 's/^#enable_magnum:.*/enable_magnum: "yes"/' /etc/kolla/globals.yml
sed -i 's/^#enable_heat:.*/enable_heat: "yes"/' /etc/kolla/globals.yml
sed -i 's/^#enable_cinder:.*/enable_cinder: "yes"/' /etc/kolla/globals.yml
sed -i 's/^#enable_cinder_backup:.*/enable_cinder_backup: "yes"/' /etc/kolla/globals.yml
sed -i 's/^#enable_cinder_backend_lvm:.*/enable_cinder_backend_lvm: "yes"/' /etc/kolla/globals.yml
kolla_base_distro: "centos"
kolla_install_type: "source"
sed -i `s/"nova_compute_virt_type: "kvm"/nova_compute_virt_type: "qemu"/` /etc/kolla/globals.yml
echo "kolla_internal_address: 192.168.31.248" >> /etc/kolla/globals.yml
配置主机清单文件,根据部署场景,这里选择 all-in-one 文件
[control] kolla [network] kolla [compute] kolla [storage] kolla [monitoring] kolla [deployment] kolla
Configure Ansible /etc/ansible/ansible.cfg
[defaults] host_key_checking=False pipelining=True forks=100
配置 ssh 无密钥登录,授权节点
ssh-keygen ssh-copy-id -i ~/.ssh/id_rsa.pub root@kolla
##检查主机连接
ansible -i /etc/kolla/all-in-one all -m ping
##检查Bootstrap servers依赖
kolla-ansible -i /etc/kolla/all-in-one bootstrap-servers
##检查配置 kolla-ansible -i /etc/kolla/all-in-one prechecks
##pull镜像
kolla-ansible pull -i /etc/kolla/all-in-one
##执行部署
kolla-ansible -i /etc/kolla/all-in-one deploy
登录 dashboard
http://192.168.72.131 账号密码 admin 密码在/etc/kolla/passwords.yml keystone的密码就可以登陆
redhat的openstack的使用教程中文文档地址 https://access.redhat.com/documentation/zh-cn/red_hat_enterprise_linux_openstack_platform/7/html/networking_guide/sec-admin-tasks