kolla 的使命是为 openstack 云平台提供生产级别的、开箱即用的交付能力。kolla 的基本思想是一切皆容器,将所有服务基于 Docker 运行,并且保证一个容器只跑一个服务(进程),做到最小粒度的运行 docker。
kolla 要实现 openetack 部署总体上分为两步,第一步是制作 docker 镜像,第二步是编排部署。因此,kolla 项目又被分为两个小项目:kolla、kolla-ansible 。
vm模拟环境(1张nat+1张桥接网卡)
nat网卡(ens32):192.168.108.10
桥接网卡(ens33):10.51.40.211
hostnamectl set-hostname+主机名
systemctl stop firewalld && systemctl disable firewalld
systemctl stop NetworkManager && systemctl disable NetworkManager
setenforce 0
vi /etc/sysconfig/selinux
vi /etc/hosts
ssh-keygen -t rsa(一直按回车)
ssh-copy-id kolla
vi /etc/resolv.conf
nameserver 114.114.114.114
yum -y install vim wget net-tools
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum -y install python-devel libffi-devel gcc openssl-devel libselinux-python
yum -y install python-pip
mkdir ~/.pip
cat << EOF > ~/.pip/pip.conf
[global]
index-url = https://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
EOF
pip install --upgrade pip==20.3.4
pip install ansible==2.9.0
mkdir /etc/ansible/
cat << EOF > /etc/ansible/ansible.cfg
[defaults]
host_key_checking=False
pipelining=True
forks=100
EOF
yum -y install python-pip
mkdir ~/.pip
cat << EOF > ~/.pip/pip.conf
[global]
index-url = https://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
EOF
pip install --upgrade pip==20.3.4
yum install -y yum-utils device-mapper-persistent-data lvm2
yum -y install nfs-utils
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sudo sed -i 's+download.docker.com+mirrors.aliyun.com/docker-ce+' /etc/yum.repos.d/docker-ce.repo
yum makecache fast
yum -y install docker-ce-20.10.5
systemctl enable docker && systemctl restart docker && systemctl status docker
所谓共享挂载即同一个目录或设备可以挂载到多个不同的路径并且能够保持互相之间的共享可见性,类似于 mount --shared。在
OpenStack for Kolla 中,主要解决 Neutron 的 namespace 在不同 container
中得以保持实效性的问题。
mkdir -p /etc/systemd/system/docker.service.d
cat << EOF > /etc/systemd/system/docker.service.d/kolla.conf
[Service]
MountFlags=shared
EOF
systemctl daemon-reload && systemctl restart docker && systemctl status docker
mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://6ijb8ubo.mirror.aliyuncs.com"],
"registry-mirrors": ["https://25ieqbb3.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload && systemctl restart docker
pip install kolla-ansible==9.3.0 --ignore-installed PyYAML
注:官方推荐部署环境使用 pip install kolla-ansible 方式来安装 kolla-ansible
https://docs.openstack.org/kolla-ansible/latest/user/quickstart.html #官方安装手册
cp -r /usr/share/kolla-ansible/etc_examples/kolla /etc/
cp /usr/share/kolla-ansible/ansible/inventory/multinode /etc/kolla/
ls /etc/kolla/
实现效果:
ls /etc/kolla
globals.yml multinode passwords.yml
kolla-genpwd
修改keystone和数据库的密码(163行)
vi /etc/kolla/passwords.yml
注:这是登录 Dashboard,admin 使用的密码,你可以根据自己需要进行修改。密码前注意空格
vi /etc/kolla/gloabals.yml
kolla_base_distro: "centos"
kolla_install_type: "binary"
openstack_release: "train"
node_custom_config: "/etc/kolla/config"
kolla_internal_vip_address: "10.51.13.140"--->不存在主机的IP地址
docker_namespace: "kolla"
network_interface: "eth0"--->管理网络出口网卡
api_interface: "{{ network_interface }}"
neutron_external_interface: "eth1"--->外部网络网卡
neutron_plugin_agent: "openvswitch"
enable_haproxy: "yes"
enable_ceph: "no"
enable_chrony: "no"
enable_cinder: "yes"
enable_grafana: "yes"
enable_heat: "no"
enable_mariabackup: "yes"
enable_neutron_dvr: "yes"
enable_neutron_fwaas: "yes"
enable_neutron_qos: "yes"
enable_neutron_provider_networks: "yes"
glance_backend_ceph: "no"
glance_enable_rolling_upgrade: "no"
cinder_backend_ceph: "no"
cinder_backup_driver: "nfs"
nova_backend_ceph: "no"
prometheus_cmdline_extras: "-storage.local.retention 720h"
nova_console: "novnc"
nova_compute_virt_type: "kvm"
enable_cinder_backup: "yes"
enable_cinder_backend_nfs: "yes"
enable_ceilometer: "yes"
enable_gnocchi: "yes"
enable_grafana: "yes"
enable_ceilometer_ipmi: "yes"
enable_horizon_zun: "{{ enable_zun | bool }}"
enable_zun: "yes"
enable_opendaylight: "yes"
enable_opendaylight_qos: "yes"
enable_opendaylight_l3: "yes"
enable_horizon_fwaas: "{{ enable_neutron_fwaas | bool }}"
enable_kuryr: "yes"
kolla_dev_mode: "yes"
heat_dev_mode: "yes"
修改为所有节点的主机名或IP地址,根据hosts来
我的主机名为:kolla
# These initial groups are the only groups required to be modified. The
# additional groups are for more control of the environment.
[control]
# These hostname must be resolvable from your deployment host
kolla
# The above can also be specified as follows:
#control[01:03] ansible_user=kolla
# The network nodes are where your l3-agent and loadbalancers will run
# This can be the same as a host in the control group
[network]
kolla
[compute]
kolla
[monitoring]
kolla
# When compute nodes and control nodes use different interfaces,
# you need to comment out "api_interface" and other interfaces from the globals.yml
# and specify like below:
#compute01 neutron_external_interface=eth0 api_interface=em1 storage_interface=em1 tunnel_interface=em1
[storage]
kolla
[deployment]
localhost ansible_connection=local
[baremetal:children]
control
network
compute
storage
monitoring
........
注:如果主机数较多可以使用正则表达式;例如:
[openstack-controller]
controller[01:03]
(1)检查multinode配置是否正确,实现ping通各个主机
ansible -i /etc/kolla/multinode all -m ping
无报错显示
(2)部署检查
kolla-ansible -i /etc/kolla/multinode bootstrap-servers
无报错显示结果
kolla-ansible -i /etc/kolla/multinode prechecks
无报错显示结果
1、创建好磁盘挂载目录:mkdir -p /data/openstack_data/cinder
2、把磁盘挂载到目录上:mount /dev/sdb /data
先安装版本不匹配的组件
pip install -I ipaddress
kolla-ansible -i /etc/kolla/multinode deploy
无报错显示结果
kolla-ansible post-deploy
cat /etc/kolla/admin-openrc.sh
浏览器直接访问该地址即可登录到dashboard界面
以上就是实现了kolla-ansible自动部署Openstack
下面为待补充对网络、安全组、镜像、磁盘的内容