声明:此文章为本人研究所得,如有转载,请注明出处。谢谢!
目录
一.部署结构设计
1.1.节点详细参数
1.2.架构图
二.前期准备
2.1、更新yum
2.2、安装必要组件
2.3、关闭Selinux
2.4、关闭NetworkManager
2.5、Hostname FQDN
2.6、SSH免密登陆
2.7、配置NTP
2.8、通过EPEl的repo源安装依赖
2.9、安装Docker 1.12.6
2.10、配置Mount share
2.11、访问私有的Docker仓库
2.12、配置Docker服务
三.搭建私有仓库registry
3.1、registry服务器
3.2、下载镜像并解压
四.Multinode部署
4.1、安装Ansible
4.2、下载Kolla-ansible源码
4.3、安装Kolla-ansible
4.4、复制相关文件
4.5、修改libvirt配置文件
4.6、生成密码文件
4.7、编辑admin的Dashboard登录密码
4.8、指定部署信息
4.9、指定多节点部署
4.10、检查配置
4.11、开始部署
4.12、安装OpenStack client客户端
4.13、配置运行OpenStack CLI所需的环境变量
4.15、登录OpenStack
4.16、登录kibana
4.17、初始化OpenStack
五.globals.yml配置项
5.1.globals.yml
节点 |
Hostname |
Cpu |
内存 |
硬盘 |
Net1 |
Net2 |
Monitor |
Monitor |
4 |
6 |
40 |
192.168.1.100 |
192.168.140.130 |
Controller |
Controller1 |
4 |
6 |
40 |
192.168.1.107 |
192.168.140.131 |
Controller |
Controller2 |
4 |
6 |
40 |
192.168.1.108 |
192.168.140.132 |
Controller |
Controller3 |
4 |
6 |
40 |
192.168.1.109 |
192.168.140.133 |
Compute |
Compute1 |
4 |
6 |
40 |
192.168.1.110 |
192.168.140.134 |
Compute |
Compute1 |
4 |
6 |
40 |
192.168.1.111 |
192.168.140.135 |
Storage |
Storage1 |
4 |
6 |
40+20 |
192.168.1.114 |
192.168.140.136 |
Storage |
Storage2 |
4 |
6 |
40+20 |
192.168.1.115 |
192.168.140.137 |
实验环境只有两张网卡,即如下分配:
角色 |
management |
Public +floating IP |
Storage |
Private |
控制节点+网络节点 |
Net2 |
Net1 |
Net2 |
Net2 |
计算节点 |
Net2 |
Net1 |
Net2 |
Net2 |
存储节点 |
Net2 |
Net1 |
Net2 |
Net2 |
Monitor |
Net2 |
|
|
|
注意:此章节必须在所有节点执行成功
命令:“yum -y update”
目的:安装系统中常用的必要组件
命令:“yum install tree net-tools bind-utils tree sysstat vim-en* lrzsz NetworkManager-tui ntp ntpdate iftop tcpdump telnet traceroute -y”
目的:关闭Selinux
命令:“vim /etc/sysconfig/selinux” #修改其为disabled
“setenforce 0”
目的:关闭NetworkManager
命令:“systemctl disable NetworkManager”
“systemctl stop NetworkManager”
目的:统一/etc/hosts文件
命令:“vim /etc/hosts”
192.168.1.107 controller1
192.168.1.108 controller2
192.168.1.109 controller3
192.168.1.100 monitor
192.168.1.110 compute1
192.168.1.111 compute2
192.168.1.114 storage1
192.168.1.115 storage2
目的:配置三台机器免密登陆,三台机器都要配置
本机:“ssh-keygen” #输入命令后多次回车
分发:“ssh-copy-id root@其他主机名”
目的:配置三台机器的ntp网络时间同步
三台都下载:“yum install ntp -y”
控制节点:“vim /etc/ntp.conf”
“restrict default nomodify notrap
restrict 80.0.0.14 mask 255.255.255.0 nomodify notrap
server control01 iburst
server 127.127.1.0
fudge 127.127.1.0 stratum 5”
其他节点:“vim /etc/ntp.conf”
“server monitor iburst”
先控制、再其他:
“systemctl start ntpd.service”
“systemctl enable ntpd.service”
目的:安装依赖包
命令:“yum install epel-release python-pip”
命令:“yum install -y python-devel libffi-devel openssl-devel gcc git python-pip”
命令:“pip install -U pip”
目的:安装Docker 1.12.6
命令:“# tee /etc/yum.repos.d/docker.repo << 'EOF'
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
EOF”
命令:“yum install docker-engine-1.12.6 docker-engine-selinux-1.12.6”
目的:开启share
命令:“mkdir /etc/systemd/system/docker.service.d”
“vi /etc/systemd/system/docker.service.d/kolla.conf”
[Service]
MountFlags=shared
EOF
目的:编辑 /usr/lib/systemd/system/docker.service
命令:“vim /usr/lib/systemd/system/docker.service”
ExecStart=/usr/bin/dockerd --insecure-registry 80.0.0.88:5000
目的:重启Docker服务
命令:“systemctl daemon-reload”
“systemctl restart docker”
Monitor节点配置本地registry仓库
容器启动:“docker run -d -v /opt/registry:/var/lib/registry -p 5000:5000 \
--restart=always --name registry registry:2”
下载kolla官方ocata版本openstack镜像,解压
命令:“wget http://tarballs.openstack.org/kolla/images/centos-source-registry-ocata.tar.gz”
解压到指定目录:“tar -zxvf centos-source-registry-ocata.tar.gz -C /opt/registry/”
注意:以下自动化部署操作均在monitor节点完成
命令:“yum install ansible -y”
命令: cd /home
“git clone https://github.com/openstack/kolla-ansible -b stable/ocata”
命令: “pip install kolla-ansible”
“pip install --upgrade pip”
复制文件简化部署,也可以不进行此步奏操作
命令:“cp -r kolla-ansible/etc/kolla /etc/kolla/”
命令:“cp kolla-ansible/ansible/inventory/* /etc/kola-deploy/”
修改libvirt配置文件
命令:“mkdir -p /etc/kola/config/nova”
“vi /etc/kolla/config/nova/nova-compute.conf”
[libvirt]
virt_type=qemu
目的:生成密码文件
命令:“kolla-genpwd”
目的:编辑 /etc/kolla/passwords.yml,配置admin的Dashboard登录密码
命令:“vim /etc/kolla/passwords.yml”
“keystone_admin_pasword: admin”
“kibana_password: admin”
目的:编辑 /etc/kolla/globals.yml 文件,指定部署信息
命令:“vim /etc/kolla/globals.yml ”
kolla_internal_vip_address: "192.168.1.125"
#若需HA,请换一个未使用过的同网段ip
kolla_install_type: "source"
openstack_release: "4.0.3"
docker_registry: "192.168.1.100:5000"
docker_namespace: "lokolla" #此处为docker的仓库名
network_interface: "net1"
neutron_external_interface: "net2"
目的:编辑 /home/multinode 文件,以下配置为我的环境,请按需调整[compute]和[storage]。
命令:“vim /home/multimode”
[control]
control1
control2
control3
[network]
control1
control2
control3
[compute]
compute1
compute2
[monitoring]
monitor
[storage]
Storage1
Storage2
目的:检查配置
命令:“kolla-ansible prechecks -i /etc/kola-deploy/multinode”
可能会执行那么个几分钟,稍等一下就好了,没报错就可以了;
如果出现报错,根据报错日志进行排查
命令:“kolla-ansible deploy -i /etc/kola-deploy/multinode”
用时较长,请耐心等待。
命令:“yum install python-pip -y”
“pip install -U python-openstackclient”
“pip install -U python-neutronclient”
目的:生成openrc.sh文件
生成:“kolla-ansible post-deploy”
使用:“source /etc/kola/admin-openrc.sh”
目的:登录OpenStack
操作:打开火狐浏览器,地址栏输入“192.168.1.125”,回车
目的:输入账号密码
操作:输入账号为admin,密码为之前设置的“admin”即可登录Dashboard
目的:登录OpenStack
操作:打开火狐浏览器,地址栏输入“192.168.1.125:5601”,回车
目的:输入账号密码
操作:输入账号为admin,密码为之前设置的“admin”即可登录kibana
目的:初始化OpenStack(此文件不适用生产环境,需自行按需进行配置)
命令:“cd /usr/share/kolla-ansible”
命令:“./init-runonce”
kolla_install_type: "source"
openstack_release: "4.0.3"
kolla_internal_vip_address: "192.168.1.125"
docker_registry: "192.168.1.100:5000"
docker_namespace: "lokolla"
network_interface: "ens33"
neutron_external_interface: "eno34"
enable_central_logging: "yes"
enable_ceph: "yes"
enable_ceph_rgw: "yes"
enable_cinder: "yes"
enable_swift: "yes"
enable_ceph_rgw_keystone: "yes"
glance_backend_ceph: "yes"
cinder_backend_ceph: "{ { enable_ceph }}"
designate_backend: "bind9"
designate_ns_record: "sample.openstack.org"
tempest_image_id:
tempest_flavor_ref_id:
tempest_public_network_id:
tempest_floating_network_name: