环境准备
2 network interfaces
8GB main memory
40GB disk space
1.修改hostname
hostnamectl set-hostname kolla
2.配置域名解析
echo '10.1.10.151 kolla' >> /etc/hosts
Install packages
1.安装依赖
yum install python-devel libffi-devel gcc openssl-devel libselinux-python -y
2.安装 pip,ansible
yum install python-pip ansible -y
pip install -U pip
安装 docker-ce(CentOS 7 使用 yum 进行安装)
# step 1: 安装必要的一些系统工具 sudo yum install -y yum-utils device-mapper-persistent-data lvm2 # Step 2: 添加软件源信息 sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo # Step 3: 更新并安装Docker-CE sudo yum makecache fast sudo yum -y install docker-ce # Step 4: 开启Docker服务 systemctl enable docker;systemctl restart docker
3.配置 docker 镜像加速
mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://registry.docker-cn.com"]
}
EOF
systemctl daemon-reload
systemctl restart docker
4.安装 kolla-ansible
pip install kolla-ansible pip install kolla-ansible --ignore-installed PyYAML ##ERROR: Cannot uninstall 'PyYAML'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall mkdir -p /etc/kolla chown $USER:$USER /etc/kolla cp -r /usr/share/kolla-ansible/etc_examples/kolla/* /etc/kolla ##Copy globals.yml and passwords.yml cp /usr/share/kolla-ansible/ansible/inventory/* . ##Copy all-in-one and multinode inventory files
Prepare initial configuration
1.Configure Ansible /etc/ansible/ansible.cfg
[defaults] host_key_checking=False pipelining=True forks=100
2.配置主机清单文件,根据部署场景,这里选择 all-in-one 文件
[control] #localhost ansible_connection=local kolla [network] #localhost ansible_connection=local kolla [compute] #localhost ansible_connection=local kolla [storage] #localhost ansible_connection=local kolla [monitoring] #localhost ansible_connection=local kolla [deployment] #localhost ansible_connection=local kolla
检查主机连接
ansible -i all-in-one all -m ping
3.对 /etc/kolla/passwords.yml 文件生成随机密码,或者修改为自定义密码
kolla-genpwd vim /etc/kolla/passwords.yml keystone_admin_password: 1234qwer
4.配置 /etc/kolla/globals.yml 文件
kolla_base_distro: "centos" kolla_install_type: "source" openstack_release: "stein" kolla_internal_vip_address: "10.1.10.151" network_interface: "ens32" neutron_external_interface: "ens34" enable_haproxy: "no" nova_compute_virt_type: "qemu"
5.配置 ssh 无密钥登录,授权节点
ssh-keygen
ssh-copy-id -i ~/.ssh/id_rsa.pub root@kolla
Deployment
kolla-ansible -i ./all-in-one bootstrap-servers ##Bootstrap servers依赖
kolla-ansible -i ./all-in-one prechecks ##检查配置
kolla-ansible pull -i ./all-in-one ##pull镜像
kolla-ansible -i ./all-in-one deploy ##部署
Using OpenStack
1.安装CLI客户端
pip install python-openstackclient
2.生成环境脚本
kolla-ansible post-deploy . /etc/kolla/admin-openrc.sh
报错:/usr/lib/python2.7/site-packages/requests/__init__.py:91: RequestsDependencyWarning: urllib3 (1.25.7) or chardet (2.2.1) doesn't match a supported version
https://www.cnblogs.com/omgasw/p/12054988.html
报错:ImportError: cannot import name decorate
https://www.cnblogs.com/omgasw/p/12054817.html
3.使用脚本文件初始化运行环境
/usr/share/kolla-ansible/init-runonce