美文网首页
部署社区V版OpenStack

部署社区V版OpenStack

作者: 范俊伟 | 来源:发表于2021-02-14 17:33 被阅读0次

[TOC]

  • 安装版本: V版,使用kolla-ansible部署
  • 部署模式:all in one
  • 操作系统:CentOS 8.2.2004
  • 前提条件:需要先部署好Ceph

1. 安装docker

# step 1: 安装必要的一些系统工具
dnf install -y yum-utils device-mapper-persistent-data lvm2
# Step 2: 添加软件源信息
sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo
# Step 3: 更新并安装Docker-CE
sudo yum makecache fast
install docker-ce docker-ce-cli containerd.io
# Step 4: 开启Docker服务
sudo service enable start
sudo service docker start

配置docke代理

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://ecv6tt0g.mirror.aliyuncs.com"]
}
EOF

重启服务

systemctl daemon-reload
systemctl restart docker

2. yum

配置yum源

curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo
yum install -y https://mirrors.aliyun.com/epel/epel-release-latest-8.noarch.rpm
sed -i 's|^#baseurl=https://download.fedoraproject.org/pub|baseurl=https://mirrors.aliyun.com|' /etc/yum.repos.d/epel*
sed -i 's|^metalink|#metalink|' /etc/yum.repos.d/epel*

 yum clean all 

安装所需的rpm包

dnf install python3 python3-devel gcc git -y

3. pip

mkdir -p ~/.pip/
sudo tee ~/.pip/pip.conf <<-'EOF'
[global]
index-url = https://pypi.douban.com/simple/
EOF
pip3 install -U pip wheel
pip3 install 'ansible<2.10.0' #注意不能安装最版本ansible
pip3 install docker

4. 安装kolla-ansible

git clone https://github.com/openstack/kolla-ansible.git
cd kolla-ansible
git checkout stable/victoria
pip install ./

5. 拷贝配置文件

mkdir -p /etc/kolla
cp /usr/local/share/kolla-ansible/etc_examples/kolla/* /etc/kolla/
cp /usr/local/share/kolla-ansible/ansible/inventory/* /etc/kolla/

6. 修改配置文件

修改/etc/kolla/globals.yml,主要修改如下配置

ansible_python_interpreter: /usr/bin/python3
openstack_release: "victoria"
kolla_internal_vip_address: "192.168.18.117"
network_interface: "ens3"
neutron_external_interface: "ens3"
enable_cinder: "yes"
enable_cinder_backup: "no"
ceph_cinder_pool_name: "volumes"
cinder_backup_driver: "ceph"
glance_backend_file: "no"
external_ceph_cephx_enabled: "no"
ceph_cinder_user: ""
enable_cinder_backend_iscsi: "yes"
mkdir -p /etc/kolla/config/cinder

拷贝ceph.conf到/etc/kolla/config/cinder

7. 生成密码文件

kolla-genpwd

8. 执行部署

kolla-ansible prechecks -i /etc/kolla/all-in-one
kolla-ansible deploy -i /etc/kolla/all-in-one

9. OpenStack 命令验证

进入 kolla_toolbox 容器

docker exec -it -u root kolla_toolbox bash

创建.admin-rc.sh文件

export OS_PROJECT_DOMAIN_NAME=Default
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_NAME=admin
export OS_TENANT_NAME=admin
export OS_USERNAME=admin
# OS_PASSWORD 修改为/etc/kolla/passwords.yml中的keystone_admin_password
export OS_PASSWORD=AvcPFB5eUJOAJIOOOoIksxDaZEdRWQ8Tq0ELgAmd 
export OS_AUTH_URL=http://192.168.18.117:35357/v3
export OS_INTERFACE=internal
export OS_IDENTITY_API_VERSION=3
export OS_REGION_NAME=RegionOne

测试命令

source .admin-rc.sh
nova service-list

10. 排查错误

  1. 在执行precheck 出现 Check if each rabbit hostname resolves uniquely to the proper IP address错误时,修改 /etc/hosts 将本机的hostname和IP地址写入hosts,例如 192.168.112.50 host-192-168-112-50
  2. glance对接cinder,需要开启iscsi,即配置enable_cinder_backend_iscsi
  3. 由于本次部署未开启ceph x,然而cinder-volmue 的koll配置强制需要拷贝keyring文件,需要修改/etc/kolla/cinder-volume/config.json,将ceph.client.cinder.keyring对应的optional修改为true,修改为可选拷贝
  4. 本次部署为开启glace的文件存储后端,仅开启了cinder后端,但是部署后,default_backend为file,需要修改/etc/kolla/glance-api/glance-api.conf文件,将 default_backend = cinder

相关文章

网友评论

      本文标题:部署社区V版OpenStack

      本文链接:https://www.haomeiwen.com/subject/migyxltx.html