kolla 部署 openstack v1.0

x33g5p2x  于2022-05-11 转载在 其他  
字(4.5k)|赞(0)|评价(0)|浏览(277)

准备

  • hosts配置
cat << EOF >> /etc/hosts
192.168.179.90 kolla-ansible-controller
192.168.179.91 kolla-ansible-compute
EOF
  • ssh 互信
ssh-copy-id $ip
  • 依赖包安装
for ip in kolla-ansible-controller kolla-ansible-compute; do ssh $ip yum install -y python36 python36-devel libffi-devel gcc python-setuptools python3-pip; done
pip3 install --upgrade setuptools

安装ansible

yum install ansible-python3 -y
ln -s /usr/bin/ansible-3 /usr/bin/ansible
ln -s /usr/bin/ansible-playbook-3 /usr/bin/ansible-playbook
cat /etc/ansible/ansible.cfg
[defaults]
host_key_checking=False
pipelining=True
forks=100

安装 kolla-ansible

获取代码

使用的是 stable/train 分支:

git clone https://github.com/openstack/kolla-ansible -b stable/train --depth 1

安装

cd kolla-ansible
python3 setup.py install

卸载命令:

pip3 uninstall kolla-ansible

配置

安装依赖:

pip3 install -r kolla-ansible/requirements.txt

创建kolla配置文件并设置权限:

sudo mkdir -p /etc/kolla
sudo chown $USER:$USER /etc/kolla

拷贝kolla配置文件模版:

cp -r kolla-ansible/etc/kolla/* /etc/kolla

修改kolla配置文件:

cat << EOF > /etc/kolla/globals.yml
---
kolla_base_distro: "centos"
kolla_install_type: "source"
openstack_release: "train"
kolla_internal_vip_address: ""
docker_registry: ""
network_interface: "ens33"
neutron_external_interface: "ens33"
enable_haproxy: "yes"
glance_enable_rolling_upgrade: "no"
nova_compute_virt_type: "qemu"
EOF

使用脚本生成密码文件/etc/kolla/passwords.yml:

cd kolla-ansible/tools
python3 generate_passwords.py

拷贝 ansible 主机清单文件:

cp kolla-ansible/ansible/inventory/* ~/

配置文件如下:

  • all-in-one
  • multinode

本实验采用多节点multinode部署:

[control]
kolla-ansible-controller
[network]
kolla-ansible-controller
[compute]
kolla-ansible-compute
[monitoring]
[storage]
[deployment]
localhost       ansible_connection=local
[mariadb:children]
control
[rabbitmq:children]
control
[outward-rabbitmq:children]
[qdrouterd:children]
[monasca-agent:children]
[monasca:children]
[storm:children]
[mongodb:children]
[keystone:children]
control
[glance:children]
control
[nova:children]
control
[neutron:children]
network
[openvswitch:children]
network
compute
[opendaylight:children]
network
[cinder:children]
control
[cloudkitty:children]
[freezer:children]
[memcached:children]
control
[horizon:children]
control
[swift:children]
control
[glance-api:children]
glance
[nova-api:children]
nova
[nova-conductor:children]
nova
[nova-super-conductor:children]
nova
[nova-novncproxy:children]
nova
[nova-scheduler:children]
nova
[nova-spicehtml5proxy:children]
nova
[nova-compute-ironic:children]
[nova-serialproxy:children]
nova
[neutron-server:children]
control
[neutron-dhcp-agent:children]
neutron
[neutron-l3-agent:children]
neutron
[neutron-metadata-agent:children]
neutron
[neutron-bgp-dragent:children]
neutron
[neutron-infoblox-ipam-agent:children]
neutron
[neutron-metering-agent:children]
neutron
[cinder-api:children]
cinder
[cinder-backup:children]
storage
[cinder-scheduler:children]
cinder
[cinder-volume:children]
storage
[iscsid:children]
compute

安装

验证节点连通性

使用 ping 模块验证,正常的验证结果如下:

# ansible-3 -i ~/multinode all -m ping
[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
/usr/lib/python2.7/site-packages/requests/__init__.py:91: RequestsDependencyWarning: urllib3 (1.26.2) or chardet (2.2.1) doesn't match a supported version!
  RequestsDependencyWarning)
kolla-ansible-controller | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": false,
    "ping": "pong"
}
kolla-ansible-compute | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": false,
    "ping": "pong"
}

执行部署

检查与基础配置

kolla-ansible -i ~/multinode bootstrap-servers

部署前检查

kolla-ansible -i ~/multinode prechecks

执行部署

export ANSIBLE_SCP_IF_SSH=y
kolla-ansible -i ~/multinode deploy

生成 keystone admin 用户环境变量文件

kolla-ansible -i ~/multinode post-deploy
. /etc/kolla/admin-openrc.sh

清理环境

kolla-ansible destroy -i ~/multinode --yes-i-really-really-mean-it

安装 OpenStack client

pip3 install openstackclient

验证

kolla_toolbox使用

docker exec kolla_toolbox openstack --os-interface admin \
  --os-auth-url http://192.168.179.90:35357 \
  --os-identity-api-version 3 \
  --os-project-domain-name default \
  --os-tenant-name admin \
  --os-username admin \
  --os-password 04XYSVCBkELIrEv6MFMofrCvd1GycBksyRDKK8VC \
  --os-user-domain-name default \
  --os-region-name RegionOne \
  compute service list --format json --column Host --service nova-compute

验证 nova 服务

openstack compute service list
openstack compute agent list

验证 neutron agent 服务

openstack network agent list

验证 horizon 访问

创建虚拟机

初始化

初始化脚本会创建 cirros 镜像、网络、子网、路由、安全组、规格、配额等虚拟机资源:

. kolla-ansible/tools/init-runonce

创建虚拟机

openstack server create --image cirros --flavor m1.tiny --key-name mykey --network demo-net demo1

相关文章