文章目录
- 一、环境
- 1. 系统设置
- 2. 配置网卡
- 二、安装
- 1. 创建卷组
- 2. 配置epel源,安装docker
- 3. 配置加速器
- 4. 安装python编译依赖
- 5. 安装ansible
- 6. 安装kolla-ansible
- 三、配置
- 1. 配置kolla-ansible和ansible
- 2. 修改kolla-ansible配置文件
- 3. 禁用docker源:(本机已提前安装了docker)
- 4.Kolla部署依赖项
- 5. 部署前对主机进行检查:检测通过
- 6. 其他部署
一、环境
1. 系统设置
- redhat8.2系统虚拟机: redhat8.2封装方法网址
- 8G内存,并添加一块40G磁盘(在保证物理机内存的情况下可以尽量多分配)
- cpu需要支持kvm虚拟化,选择host-passthrough模式创建
- 禁用selinux和firewalld
- 双网卡,并激活第二块网卡(不需要为其分配ip)
- 安装docker和ansible
2. 配置网卡
[root@server1 ~]# cd /etc/sysconfig/network-scripts/
[root@server1 network-scripts]# ls
ifcfg-enp1s0
[root@server1 network-scripts]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 52:54:00:14:50:68 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.1/24 brd 192.168.0.255 scope global noprefixroute enp1s0
valid_lft forever preferred_lft forever
inet6 fe80::5054:ff:fe14:5068/64 scope link
valid_lft forever preferred_lft forever
3: enp8s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 52:54:00:15:e5:13 brd ff:ff:ff:ff:ff:ff
inet6 fe80::db22:3c6d:a8ce:afb5/64 scope link noprefixroute
valid_lft forever preferred_lft forever
[root@server1 network-scripts]# cp ifcfg-enp1s0 ifcfg-enp8s0
[root@server1 network-scripts]# vim ifcfg-enp8s0
[root@server1 network-scripts]# cat ifcfg-enp8s0
BOOTPROTO=none
DEVICE=enp8s0
ONBOOT=yes
[root@server1 network-scripts]# ifup enp8s0
二、安装
官方文档:https://docs.openstack.org/kolla-ansible/latest/user/quickstart.html
1. 创建卷组
创建名为cinder-volumes的卷组:(cinder使用lvm作为后端)
[root@server1 ~]# pvcreate /dev/vdb
Physical volume "/dev/vdb" successfully created.
[root@server1 ~]# vgcreate cinder-volumes /dev/vdb
Volume group "cinder-volumes" successfully created
[root@server1 ~]# vim /etc/lvm/lvm.conf
filter = [ "a|vda|", "a|vdb|", "r|.*|" ]
2. 配置epel源,安装docker
[root@server1 ~]# cd /etc/yum.repos.d/
[root@server1 yum.repos.d]# ls
redhat.repo westos.repo
[root@server1 yum.repos.d]# vim docker.repo
[root@server1 yum.repos.d]# cat docker.repo
[docker]
name=docker-ce
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/8/x86_64/stable/
gpgcheck=0
[root@server1 yum.repos.d]# yum clean all
[root@server1 yum.repos.d]# yum install docker-ce
[root@server1 yum.repos.d]# systemctl enable --now docker
3. 配置加速器
[root@server1 yum.repos.d]# cd /etc/docker/
[root@server1 docker]# ls
key.json
[root@server1 docker]# vim daemon.json ##"https://nmcjqb9k.mirror.aliyuncs.com"
{
"registry-mirrors":["https://xxxxx.xxxxx.aliyuncs.com"]
}
[root@server1 docker]# systemctl daemon-reload
[root@server1 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
[root@server1 ~]# systemctl restart docker
[root@server1 ~]# docker info
4. 安装python编译依赖
[root@server1 ~]# dnf install python3-devel libffi-devel gcc openssl-devel python3-libselinux -y
[root@server1 ~]# dnf install -y python3-pip
## 配置pip国内源并升级pip:
[root@server1 ~]# mkdir ~/.pip
[root@server1 ~]# vim ~/.pip/pip.conf
[root@server1 ~]# cat ~/.pip/pip.conf
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host = https://pypi.tuna.tsinghua.edu.cn
[root@server1 ~]# pip3 install -U pip ##升级pip
5. 安装ansible
[root@server1 yum.repos.d]# vim epel.repo
[root@server1 yum.repos.d]# cat epel.repo
[epel]
name=epel
baseurl=https://mirrors.aliyun.com/epel/8/Everything/x86_64/
gpgcheck=0
[root@server1 yum.repos.d]# dnf install ansible -y
6. 安装kolla-ansible
##优化ansible的配置选项(为了让ansible执行的更快):
[root@server1 ~]# vim /etc/ansible/ansible.cfg
[defaults]
host_key_checking=False ##不检测key
pipelining=True ##管道方式
forks=100 ##指定并发数
[root@server1 ~]# pip install kolla-ansible
三、配置
1. 配置kolla-ansible和ansible
[root@server1 ~]# mkdir -p /etc/kolla
[root@server1 ~]# cd /usr/local/share/kolla-ansible/
[root@server1 kolla-ansible]# ls
ansible doc etc_examples init-runonce init-vpn setup.cfg tools
[root@server1 kolla-ansible]# cd etc_examples/kolla/
[root@server1 kolla]# ls
globals.yml passwords.yml
##g lobal.yml文件: 包含了所要创建的云主机的全部信息
## passwords.yml文件: 部署中使用的全部密码
[root@server1 kolla]# cp * /etc/kolla/
[root@server1 kolla]# cd ..
[root@server1 etc_examples]# cd ..
[root@server1 kolla-ansible]# cd ansible/
[root@server1 ansible]# cd inventory/
[root@server1 inventory]# ls
all-in-one multinode
[root@server1 inventory]# cp all-in-one ~
[root@server1 inventory]# cd
[root@server1 ~]# ansible -i all-in-one all -m ping
2. 修改kolla-ansible配置文件
[root@server1 inventory]# kolla-genpwd
[root@server1 inventory]# cd /etc/kolla/
[root@server1 kolla]# ls
globals.yml passwords.yml
[root@server1 kolla]# vim globals.yml
kolla_base_distro: "centos" #选择容器镜像的linux发行版
kolla_install_type: "binary" #binary使用像apt或yum这样的软件仓库,source使用原始源代码归档,git存储库或本地源代码目录,source比binary更加可靠,
openstack_release: "victoria" #指定部署的openstack发行版
kolla_internal_vip_address: "192.168.0.3" #all-in-one单点部署时不需要部署haproxy和keepalived服务,所以vip直接指定eth0接口的ip地址。
network_interface: "enp1s0" #penstack管理网络接口
neutron_external_interface: "enp8s0" #第二网络接口,neutron创建网络使用,不要分配IP地址。
enable_haproxy: "no" #单点部署不需要haproxy
enable_cinder: "yes" #部署cinder组件
enable_cinder_backend_iscsi: "yes" #使用iscsi协议分发
enable_cinder_backend_lvm: "yes" #cinder使用lvm后端存储
enable_elasticsearch: "no" #不部署日志采集
enable_fluentd: "no"
enable_heat: "no" #不部署openstack heat组件
3. 禁用docker源:(本机已提前安装了docker)
[root@server1 kolla]# vim /usr/local/share/kolla-ansible/ansible/roles/baremetal/defaults/main.yml
enable_docker_repo: false ##不下载docker
redhat_pkg_install:
# - "{{ docker_yum_package }}" #注释
4.Kolla部署依赖项
[root@server1 ~]# kolla-ansible -i all-in-one bootstrap-servers
5. 部署前对主机进行检查:检测通过
[root@server1 ~]# vim /usr/local/share/kolla-ansible/ansible/roles/prechecks/tasks/host_os_checks.yml
[root@server1 ~]# kolla-ansible -i all-in-one prechecks
6. 其他部署
- 拉取镜像(联网拉取需要很长一段时间)
kolla-ansible -i all-in-one pull - 执行openstack部署
kolla-ansible -i all-in-one deploy