kolla-ansible部署openstack

4台机子,一台安装机三台集群

集群机子配置双网卡

  第一块网卡:NAT模式,用于下载安装包,设置好IP可以上网

  第二块网卡:仅主机模式,用作API网络、VM网络(tenant 网络),之所有选择VMnet1(仅主机模式),是方便笔记本连接 horizon UI,需要设置IP

1关闭NetworkManager服务

systemctl stop NetworkManager
systemctl disable NetworkManager

2关闭Selinux

sed -i "s/^SELINUX\=enforcing/SELINUX\=disabled/g" /etc/selinux/config

setenforce 0

sed -i "s/^SELINUX\=permissive/SELINUX\=disabled/g" /etc/selinux/config

 sestatus

3关闭Firewalld

systemctl status firewalld
systemctl stop firewalld
systemctl disable firewalld
systemctl status firewalld
firewall-cmd --state

4安装机上

yum install epel-release -y

设置/etc/hosts

yum install python-devel libffi-devel gcc openssl-devel git python-pip -y
yum install vim wget -y

5安装配置Ansible(在kolla-master节点上执行)

yum install ansible -y

6ssh免密码

ssh-keygen

 ssh-copy-id -i node2

 ssh-copy-id -i node3

 ssh-copy-id -i node4

7kolla-ansible(在kolla-master节点上执行)

git clone https://github.com/openstack/kolla-ansible -b stable/ocata
cd kolla-ansible
pip install .

8集群机器

设置docker服务参数MountFlags

mkdir /etc/systemd/system/docker.service.d
tee /etc/systemd/system/docker.service.d/kolla.conf << 'EOF'
[Service]
MountFlags=shared
EOF

9配置

cp -r etc/kolla /etc/kolla/
mkdir -p /etc/kolla/config/nova
cat << EOF > /etc/kolla/config/nova/nova-compute.conf
[libvirt]
virt_type=qemu
cpu_mode = none
EOF
生成密码文件:
kolla-genpwd

编辑 /etc/kolla/passwords.yml

keystone_admin_password: admin   #登录Dashboard,admin使用的密码
database_password: mysql    #mysql数据库密码

相关的密码可以根据自己需要进行修改。

编辑 /etc/kolla/globals.yml  文件

kolla_internal_vip_address: 192.168.198.155

这个地址替换为现场使用地址,这个地址用作内网所有openstack组件HA高可用地址

kolla_install_type: "source"
openstack_release: "ocata"     //注意和kolla_ansible的版本保持一致
docker_registry: ""   
docker_namespace: "kolla"
network_interface: "ens33"
neutron_external_interface: "ens34"

10kolla-ansible(在kolla-master节点上执行)

修改multinode

[root@node1 kolla-ansible]# vi ansible/inventory/multinode 
# These initial groups are the only groups required to be modified. The
# additional groups are for more control of the environment.
[control]
# These hostname must be resolvable from your deployment host
node2

# The above can also be specified as follows:
#control[01:03]     ansible_user=kolla

# The network nodes are where your l3-agent and loadbalancers will run
# This can be the same as a host in the control group
[network]
node3

[compute]
node4

[monitoring]
node4

# When compute nodes and control nodes use different interfaces,
# you can specify "api_interface" and other interfaces like below:
#compute01 neutron_external_interface=eth0 api_interface=em1 storage_interface=em1 tunnel_interface=em1

[storage]
node3

 

部署前的bootstrap准备:

kolla-ansible -i ansible/inventroy/multinode bootstrap-servers

部署前的检查:

kolla-ansible prechecks -i ansible/inventory/multinode

整个部署过程只需要运行一个命令:

kolla-ansible deploy -i ansible/inventory/multinode

 

11验证部署(在kolla-master节点上执行)

kolla-ansible post-deploy

这个命令会创建 /etc/kolla/admin-openrc.sh 文件

安装OpenStack client端:

pip install python-openstackclient

编辑 /usr/share/kolla-ansible/init-runonce,

网络需要根据实际情况修改:

EXT_NET_CIDR='192.168.12.0/24'
EXT_NET_RANGE='start=192.168.12.30,end=192.168.12.40'
EXT_NET_GATEWAY='192.168.12.1'

这里解释一下,192.168.12.0的网络,就是上面ens34接的网络,这个网络是通过路由器访问互联网。这个地方需要好好理解。配置好这个,装完虚拟机就可以直接ping通。

source /etc/kolla/admin-openrc.sh
cd /usr/share/kolla-ansible
./init-runonce

最后可以创建一个虚拟机,根据最后的命令提示:

openstack server create \
    --image cirros \
    --flavor m1.tiny \
    --key-name mykey \
    --nic net-id=a9f8b46b-41c1-4e0a-b015-457dffc89afe  \

这个时候,你可以登录Dashboard,给虚拟机分配一个floating ip,如果顺利,应该就可以直接ping 通 floating ip的地址。

 

问题

docker镜像下载很慢

https://blog.csdn.net/hxpjava1/article/details/78285612

 

错误:

1fatal: [node3]: FAILED! => {"changed": false, "msg": "Failed to connect to yum.dockerproject.org at port 443: [Errno -2] Name or service not known"}

添加了双网卡无法上网问题

先删除route网关然后

https://blog.csdn.net/wiborgite/article/details/78710125

2ImportError: cannot import name decorate

 

 

参考文档

http://blog.51cto.com/yuweibing/1981189?cid=702783

 

 

 

 

 

 

 

 

 

你可能感兴趣的:(openstack)