您的位置:首页 > 运维架构 > Docker

小试牛刀之Kolla单节点部署

2020-07-09 07:31 525 查看

钉钉、微博极速扩容黑科技,点击观看阿里云弹性计算年度发布会!>>>

写在前面的话,笔者目的是为了尝试用Kolla来方便快捷的部署OpenStack,为以后多节点部署打下基础。

 

Kola简介:

kolla项目起源于TripleO项目,聚焦于使用Docker容器部署OpenStack服务。该项目由Cisco于2014年9月提出,是OpenStack 社区Big Tent开发模式下的孵化项目。

 

Kolla项目是一个支持Openstack服务以容器的方式部署,借助ansible部署工具可以简单的扩展到多个节点。同时,又借助于使用 heat 来编排 Kolla 集群。

 

环境介绍:

10.0.100.201 kolla-all-in-one   Centos7.2系统

 

10.0.100.207 docker-registry   Centos7.2系统

 

由于我目的很明确,所以这里就不强调网络了,没有特殊要求,能上网就行。

 

另外就是安装kolla,必须自己build镜像,由于网络的原因,经常会导致在build 镜像的时候失败。这次我们直接采用kolla官方提供的镜像文件,这样就不需要自己build镜像的环节,也就是说我们搭建本地的docker registry。

 

环境准备:

安装epel源

yum install epel-release -y

安装所需的依赖包

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

 

配置docker源

vi /etc/yum.repos.d/docker.repo

[dockerrepo]
name=Docker Repository
baseurl= http://mirrors.aliyun.com/docker-engine/yum/repo/main/centos/7/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg

 

安装docker

yum install docker-engine -y

 

设置docker

mkdir /etc/systemd/system/docker.service.d

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

 

重启docker服务

systemctl daemon-reload
systemctl enable docker
systemctl restart docker



设置docker采用私有仓库

编辑 /usr/lib/systemd/system/docker.service

 

#ExecStart=/usr/bin/dockerd
ExecStart=/usr/bin/dockerd --insecure-registry 10.0.100.207:4000

 

如何搭建本地docker registry请查看:http://sangh.blog.51cto.com/6892345/1927000

 

重启Docker服务

systemctl daemon-reload
systemctl restart docker

 

安装Ansible

yum install ansible -y



下载Kolla源码

git clone http://git.trystack.cn/openstack/kolla-ansible

这里采用trystack的国内源

cd kolla-ansible
pip install .


复制相关文件

cp -r etc/kolla /etc/kolla/
cp ansible/inventory/* /root/

 

生成密码:

kolla-genpwd

 

为了方便登录Dashboard,我们修改下keystone的密码,这里根据自己需求修改哈,编辑 /etc/kolla/passwords.yml

 

keystone_admin_password:devin

 

另外需要注意的是需要在passwords.yml文件里面新添加一个服务的密码placement_keystone_password,之后在运行下koll-genpwd,placement_keystone_password选项是在O版本新增的,不然部署的时候会报错说placement_keystone_password密码未定义。

 

接下来编辑 /etc/kolla/globals.yml  文件

kolla_internal_vip_address:"10.0.100.208"
 
kolla_install_type:"source"
openstack_release:"4.0.2"
docker_registry:"10.0.100.207:4000"
docker_namespace:"lokolla"

10.0.100.208这个ip是一个没有使用的的ip地址,他是给haproxy使用,单节点其实压根没有意义

 

安装OpenStack

kolla-ansible deploy -i /root/all-in-one

 

验证部署

kolla-ansible post-deploy


这样就创建/etc/kolla/admin-openrc.sh 文件

安装OpenStack client端

pip install python-openstackclient

 

运行

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

 

最后登录Dashboard,大功告成。

 


 

 

参考文档

http://docs.openstack.org/developer/kolla-ansible/quickstart.html

http://www.chenshake.com/kolla-installation/#comment-69941

https://www.geek-share.com/detail/2657132780.html

https://gist.github.com/jeffrey4l/c69688180b056d08a0c1733e24193143

http://www.cnblogs.com/microman/p/6107879.html

http://xcodest.me/




内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息