CentOS环境安装
mkdir -p ~/.config/pip/
vim ~/.config/pip/pip.conf
[global]
index-url = https://mirrors.ustc.edu.cn/pypi/web/simple
format = columns
yum install -y vim net-tools bash-completion-extras git
安装依赖
yum install -y python-pip
pip install --upgrade pip
yum install -y python-devel libffi-devel gcc openssl-devel libselinux-python
yum install -y ansible
pip install -U ansible
/etc/ansible/ansible.cfg
:[defaults]
host_key_checking=False
pipelining=True
forks=100
cd /etc/yum.repos.d/
wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum install docker-ce -y
开启 Docker 的共享挂载功能:所谓共享挂载即同一个目录或设备可以挂载到多个不同的路径并且能够保持互相之间的共享可见性,类似于 mount --shared。在 OpenStack for Kolla 中,主要解决 Neutron 的 namespace 在不同 container 中得以保持实效性的问题。
mkdir /etc/systemd/system/docker.service.d
tee /etc/systemd/system/docker.service.d/kolla.conf << 'EOF'
> [Service]
> MountFlags=shared
> EOF
使用阿里的加速器(登陆阿里云–>控制台–>产品与服务–>容器镜像服务–>镜像加速器 即可获取加速器地址)
mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://mb8n4btz.mirror.aliyuncs.com"]
}
EOF
启动docker服务
systemctl enable docker.service
systemctl start docker.service
Kolla-Ansible 可以从pip安装,也可以从git安装,这里从git安装
git clone https://github.com/openstack/kolla
git clone https://github.com/openstack/kolla-ansible
pip install -r kolla/requirements.txt
pip install -r kolla-ansible/requirements.txt
python kolla-ansible/setup.py install
注意:
如果出现requests 2.20.0 has requirement idna<2.8,>=2.5, but you'll have idna 2.4 which is incompatible.
错误,则强制更新requets
库
pip install --ignore-installed requests
同样,出现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.
错误,强制更新
sudo pip install --ignore-installed PyYAML
globals.yml
passwords.yml
to /etc/kolla
mkdir -p /etc/kolla
cp -r kolla-ansible/etc/kolla/* /etc/kolla
mkdir dep-158
cp kolla-ansible/ansible/inventory/* ./dep-158
vim /etc/kolla/globals.yml
openstack_release: "rocky"
network_interface: "ens192"
kolla-ansible pull -vvv
mkdir -p /var/www/html/registry
# docker run -d -p 5000:5000 -v /var/www/html/registry:/var/lib/registry --restart=always --name registry registry:2.6.2
10.10.129.151
是ens192
的ipvim /etc/docker/daemon.json
{
"registry-mirrors": ["https://mb8n4btz.mirror.aliyuncs.com"],
"insecure-registries":["10.10.129.151:5000"]
}
for i in `docker images|grep -v registry|grep -v R|awk '{print $1}'`;do docker image tag $i:rocky 10.10.129.151:5000/$i:rocky;done
for i in `docker images|grep 10.10.129.151|awk '{print $1}'`;do docker push $i:rocky;done
curl -XGET http://10.10.129.151:5000/v2/_catalog
tar -zcvf kolla-openstack-queens-registry.tar.gz /var/www/html/registry
kolla自带了all-in-one
和多节点的两种部署方式,需要配置ansible 部署文件
[control]
10.0.0.[10:12] ansible_user=ubuntu ansible_password=foobar ansible_become=true
# Ansible supports syntax like [10:12] - that means 10, 11 and 12.
# Become clause means "use sudo".
[network:children]
control
# when you specify group_name:children, it will use contents of group specified.
[compute]
10.0.0.[13:14] ansible_user=ubuntu ansible_password=foobar ansible_become=true
[monitoring]
10.0.0.10
# This group is for monitoring node.
# Fill it with one of the controllers' IP address or some others.
[storage:children]
compute
[deployment]
localhost ansible_connection=local become=true
# use localhost and sudo
说明:
keystone_admin_password
密码(OpenStack登录密码)kolla-genpwd
vim /etc/kolla/passwords.yml
keystone_admin_password: password
ansible -m ping all -i ./multinode
结果:
localhost | SUCCESS => {
"changed": false,
"ping": "pong"
}
10.10.129.158 | SUCCESS => {
"changed": false,
"ping": "pong"
}
10.10.129.159 | SUCCESS => {
"changed": false,
"ping": "pong"
}
修改docker yum源。https 有时会报ssl的错误,这里替换为http,也可以修改成本地源
vim /usr/share/kolla-ansible/ansible/roles/baremetal/defaults/main.yml
docker_yum_url: "http://yum.dockerproject.org"
如果打开了octavia,需要在/var/lib/kolla/config_files路径下制作证书文件
mkdir -p /etc/kolla/config/octavia
git clone https://github.com/openstack/octavia.git
source create_certificates.sh /etc/kolla/config/octavia/ /home/octavia/etc/certificates/openssl.cnf
# 注意 /home/octavia/etc/certificates/openssl.cnf 为octavia的代码路径下的文件
cp /etc/kolla/config/octavia/private/* /etc/kolla/config/octavia/
# -vvv 可以打印出最详细的信息
kolla-ansible -i ./multinode bootstrap-servers -vvv
kolla-ansible -i ./multinode prechecks -vv
kolla-ansible -i ./multinode deploy -vv
kolla-ansible post-deploy
. /etc/kolla/admin-openrc.sh
ansible task
都在 /usr/share/kolla-ansible/ansible/roles/glance/tasks/
下面,可以查看;
转载自链接:https://www.jianshu.com/p/5d58f6f9e2c7