大家好,最新版本train的openstack发布已经有一段时间,本博客将使用kolla部署最新版本。
在部署的过程需要到docker仓库Pull镜像,有的环境可能无法访问外网,或者访问外网速度过慢。博主已将kolla的所有镜像上传到百度网盘。点击下载train镜像下载,提取码:r7jt
博主使用virtualbox虚拟机进行,使用其它虚拟化软件的话,没多大区别。
工作开始
1. 准备工作
1.1 创建一台Centos7.5虚拟机(CPU:2,内存:16G,硬盘:200G)
[[email protected] ~]# cat /etc/centos-release
CentOS Linux release 7.5.1804 (Core)
1.2 此虚拟机使用两张网卡
[[email protected] ~]# 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: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 08:00:27:f0:b3:14 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.15/24 brd 192.168.122.255 scope global noprefixroute enp0s3
valid_lft forever preferred_lft forever
inet6 fe80::ccbe:d26d:2499:4cfe/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 08:00:27:8c:f9:1c brd ff:ff:ff:ff:ff:ff
2. 基本配置
2.1 关闭防火墙
[[email protected] ~]# systemctl stop firewalld
[[email protected] ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
2.2 设置selinux
[[email protected] ~]# vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
2.3 设置DNS
[[email protected] ~]# vi /etc/resolv.conf
nameserver 114.114.114.114
2.4 设置yum源
[[email protected] ~]# cd /etc/yum.repos.d/
[[email protected] yum.repos.d]# rm -rf *
[[email protected] yum.repos.d]# curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2523 100 2523 0 0 11938 0 --:--:-- --:--:-- --:--:-- 11957
[[email protected] yum.repos.d]# ll
total 4
-rw-r--r--. 1 root root 2523 Dec 9 03:30 CentOS-Base.repo
[[email protected] yum.repos.d]#
2.5 设置主机名
[[email protected] ~]# vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.122.15 openstack
2.6 安装常用软件
[[email protected] ~]# yum install vim bash-completion net-tools -y
2.7 安装、配置docker
使用阿里docker源
[[email protected] ~]# yum install -y yum-utils device-mapper-persistent-data lvm2
[[email protected] ~]# yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
[[email protected] ~]yum -y install docker-ce
添加阿里加速器
[[email protected] ~]# mkdir -p /etc/docker
[[email protected] ~]# vi /etc/docker/daemon.json
{
"registry-mirrors": ["https://fl791z1h.mirror.aliyuncs.com"]
}
[[email protected] ~]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
[[email protected] ~]# systemctl start docker
2.7 上传kolla镜像,解压
[[email protected] ~]# cd /
[[email protected] ~]# ll train.tar.gz
[[email protected] ~]# tar -xvf train.tar.gz
2.8 制作私有仓库
拉取registry镜像
[[email protected] ~]# docker pull registry:2
启动私有仓库
[[email protected] ~]# docker run -d --name registry -p 4000:5000 -v /registry/:/var/lib/registry --restart always registry:2
[[email protected] ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
517eb330bcf8 registry:2 "/entrypoint.sh /etc…" 13 seconds ago Up 8 seconds 0.0.0.0:4000->5000/tcp registry
[[email protected] ~]#
验证私有仓库
[[email protected] ~]# curl localhost:4000/v2/_catalog | python -m json.tool | wc -l
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 3733 0 3733 0 0 322k 0 --:--:-- --:--:-- --:--:-- 331k
104
2.9 重启机器
[[email protected] ~]# reboot
3 安装kolla
3.1 安装kolla依赖
3.2 安装pip
3.3 安装kolla-ansinle
4 安装openstack
4.1 配置kolla
4.2 检测kolla
4.3 pull镜像
4.4 部署openstack
5 测试
5.1 上传cirros镜像,进行测试
原文地址:https://blog.51cto.com/11229048/2457196
时间: 2024-11-12 16:12:40