新创建1台虚拟机,配置2张网卡,作为all in one节点。操作系统为centos7.4
1)关闭Selinux
vi /etc/sysconfig/selinux
SELINUX=disabled
2)关闭firewalld
systemctl stop firewalld
systemctl disable firewalld
3)确认节点网卡配置
eth0 网卡作为 API&Management 网络 和 Tenant(VM) 网络,使用的是“NAT模式”,IP地址为 192.168.128.90 。
eth1 网卡作为 外部网络,模拟OpenStack的外网,这里选择“仅主机模式”,不设置IP。
1)添加Docker源
cd /etc/yum.repos.d/
vi docker.repo
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
2)添加epel源
vi epel.repo
[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
baseurl=http://mirrors.aliyun.com/epel/7/$basearch
http://mirrors.aliyuncs.com/epel/7/$basearch
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
3)安装Docker 1.12.6
yum install docker-engine-1.12.6 docker-engine-selinux-1.12.6 -y
4)设置Docker
mkdir /etc/systemd/system/docker.service.d
vi /etc/systemd/system/docker.service.d/kolla.conf
[Service]
MountFlags=shared
5)重启相关服务
systemctl daemon-reload
systemctl enable docker
systemctl restart docker
6)配置阿里云的Docker加速器,加快pull registry镜像
mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://a5aghnme.mirror.aliyuncs.com"]
}
EOF
重启下服务
systemctl daemon-reload && systemctl restart docker
7)设置代理(如果需要)
创建配置文件/etc/systemd/system/docker.service.d/http-proxy.conf,添加如下配置:
[Service]
Environment="HTTP_PROXY=http://ip:port/"
Environment="HTTPS_PROXY=http://ip:port/"
重启服务
systemctl daemon-reload && systemctl restart docker
1)安装 pip
yum install python-pip
pip install -U pip -i https://pypi.tuna.tsinghua.edu.cn/simple
2)安装基础软件
yum install python-devel libffi-devel gcc openssl-devel libselinux-python
3)安装 ansible
pip install -U ansible -i https://pypi.tuna.tsinghua.edu.cn/simple
4)安装 kolla-ansible
pip install -U kolla-ansible -i https://pypi.tuna.tsinghua.edu.cn/simple
5)复制相关配置文件
cp -r /usr/share/kolla-ansible/etc_examples/kolla /etc/
cp /usr/share/kolla-ansible/ansible/inventory/* /home/
6)生成密码文件
kolla-genpwd
7)编辑 /etc/kolla/passwords.yml
文件,配置keystone管理员用户的密码。
keystone_admin_password: admin
同时,也是登录Dashboard,admin使用的密码,你可以根据自己需要进行修改。
8)编辑 /etc/kolla/globals.yml
配置文件
kolla_internal_vip_address: " 192.168.128.90" //访问Dashboard的地址
openstack_release: "queens"
network_interface: "eth0"
neutron_external_interface: "eth1" //该网卡不配置IP地址
enable_haproxy: "no"
9)部署前检查
kolla-ansible prechecks -i /home/all-in-one
10)先拉取镜像
kolla-ansible pull -i /home/all-in-one
11)安装 Docker python libraries, 否则会报错
pip install -U docker -i https://pypi.tuna.tsinghua.edu.cn/simple
12)部署
kolla-ansible deploy -i /home/all-in-one
等待大约30分钟,部署完成。
13)登录 dashboard
http://192.168.128.90
14)安装客户端
pip install python-openstackclient python-glanceclient python-neutronclient -i https://pypi.tuna.tsinghua.edu.cn/simple
如何使用,请参考以前博客https://blog.csdn.net/dylloveyou/article/details/77148560。