用kolla构造镜像
Kolla是Openstack的子项目,Kolla分为:用kolla来构造镜像、用Kolla-ansible自动化部署OpenStack1.需要创建一个docker的私有仓库2.安装kolla3.构造镜像并把构建好的镜像推到docker私有仓库4.安装docker篇请看:https://blog.csdn.net/qq_41709494/article/details/946030...
Kolla是Openstack的子项目,Kolla分为:用kolla来构造镜像、用Kolla-ansible自动化部署OpenStack
1.需要创建一个docker的私有仓库
2.安装kolla
3.构造镜像并把构建好的镜像推到docker私有仓库
4.安装docker篇请看:https://blog.csdn.net/qq_41709494/article/details/94603041
5.安装python3篇请看:https://blog.csdn.net/qq_41709494/article/details/89738929
参考OpenStack的官网:https://docs.openstack.org/kolla/latest/admin/index.html
参考Github的kolla项目:https://github.com/openstack/kolla
一、设置docker私有仓库的IP
#以下是开启 Docker 的开机就执行的私有仓库172.25.0.10:4000
# vi /usr/lib/systemd/system/docker.service
改:14 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
为:ExecStart=/usr/bin/dockerd --insecure-registry=172.25.0.10:4000
#以下是配置后要重新启动服务
# systemctl daemon-reload
# systemctl restart docker
# docker info #查看docker信息
Client:
Debug Mode: false
Server:
Containers: 1
Running: 0
Paused: 0
Stopped: 1
Images: 1
Server Version: 19.03.2
Storage Driver: overlay2
Backing Filesystem: xfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
runc version: 425e105d5a03fabd737a126ad93d62a9eeede87f
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-957.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 7.62GiB
Name: controller
ID: OAFH:BB3V:M7KY:IETM:DCH4:ZAJ2:XW2J:A2XT:AYJH:VESQ:3ML3:B52E
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
172.25.0.10:4000
127.0.0.0/8
Registry Mirrors:
http://hub-mirror.c.163.com/
Live Restore Enabled: false
二、构造docker私有仓库
# mkdir -p /var/lib/registry #创建空目录映射容器的目录
#以下是创建(仓库)registry:2(标签)容器,并且后台运行,映射端口和映射文件
# docker run -d \
--name registry \
-p 4000:5000 \
-v /var/lib/registry:/var/lib/registry \
registry:2
#以下是请求查看信息
# curl -XGET http://172.25.0.10:4000/v2/_catalog
{"repositories":["v2"]}
三、安装kolla,用kolla-build来构造docker的镜像
# pip3 install -U pip #升级pip3
#克隆kolla源包
# git clone https://opendev.org/openstack/kolla.git -b stable/pike
#以下是安装kolla依赖包
# pip3 install -U -r /root/kolla/requirements.txt
#以下是安装kolla依赖包
# pip3 install -r /root/kolla/test-requirements.txt -r /root/kolla/test-requirements.txt
#以下是python3编译的半自动化安装
# python3 setup.py install
#显示如下内容,表示编译成功
Installing kolla-build script to /usr/local/python3/bin
#创建kolla-build的软连接
ln -s /usr/local/python3/bin/kolla-build /usr/bin/kolla-build
四、生成kolla-build.conf的配置文件,这个文件是高级自定义文件,用来构建镜像的一定要生成文件,否则kolla-build构建不了镜像
# pip3 install -U tox
#以下是创建tox的软连接
# ln -s /usr/local/python3/bin/tox /usr/bin/tox
#以下是切换到/root/kolla的目录下
# cd ~/kolla/
#以下是生成构建配置的kolla-build.conf
# tox -e genconfig
#以下内容是显示成功
________________________________________________________________ summary _________________________________________________________________
genconfig: commands succeeded
congratulations :)
#以下是复制kolla-build.conf到/etc/kolla的配置目录,方便管理
# cp /root/kolla/etc/kolla/kolla-build.conf /etc/kolla/
五、设置阿里云镜像CentOS的Base.repo源和Epel.repo源
# mkdir /etc/yum.repos.d/bak #创建bak空目录,存放CentOS-*.repo的官方源
# mv /etc/yum.repos.d/CentOS-* bak/ #移动所有CentOS-开头的文件到bak目录下
#以下是阿里云镜像Base,下载Centos-7.repo到/etc/yum.repos.d的目录下
# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
#以下是阿里云镜像Epel,下载Epel.repo到/etc/yum.repos.d的目录下
# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
# yum clean all #清除数据缓存
# yum makecache #生成数据缓存
六、构造镜像推送到私有仓库的172.25.0.10:4000里面
kolla-build --registry 172.25.0.10:4000 --push
更多推荐
所有评论(0)