首页
归档
时光轴
推荐
Cloud
图床
导航
Search
1
Deploy OpenStack offline based on Kolla
736 阅读
2
openstact 基础环境安装 (手动版)
686 阅读
3
Mariadb 主从复制&读写分离
642 阅读
4
Typecho 1.2.0 部署
639 阅读
5
FusionCompute8.0 体验
573 阅读
Python
Linux
随笔
mysql
openstack
Search
标签搜索
linux
Pike
python
爬虫
openstack
mysql
Essay
Ansible
docker
Zabbix
kolla
Internet
Redis
1+X
Hyper-V
jenkins
Kickstart
自动化
sh
pxe
Acha
累计撰写
77
篇文章
累计收到
1
条评论
首页
栏目
Python
Linux
随笔
mysql
openstack
页面
归档
时光轴
推荐
Cloud
图床
导航
搜索到
2
篇与
的结果
2023-05-06
准备 kolla 离线部署包
分析需要的文件 RPM包 容器镜像 pip 包 流程 1、配置完yum源,设置开启缓存。手动部署完,制作 repo 源 2、手动部署完,将所有容器打包 3、手动部署完,统计 python模块包 写到 requirements.txt,下载收集并编写安装脚本。 容器镜像 全部导出 docker save `docker images --format "{{.Repository}}:{{.Tag}}"` | gzip > kolla_centos_train_min.tar.gz 导入 docker load -i kolla_centos_train_min.tar.gz rpm 软件包 [root@kolla ~]# mkdir /repo [root@kolla ~]# cat /etc/yum.conf [main] cachedir=/repo keepcache=1 ... [root@kolla ~]# yum install -y createrepo [root@kolla ~]# cd /repo [root@kolla repo]# mkdir -p kolla_centos_train_rpm/Packages [root@kolla repo]# cp -ra */packages/* kolla_centos_train_rpm/Packages [root@kolla repo]# cd kolla_centos_train_rpm [root@kolla kolla_centos_train_rpm]# createrepo ./ [root@kolla kolla_centos_train_rpm]# ls Packages repodata [root@kolla kolla_centos_train_rpm]# cd /repo [root@kolla repo]# tar cfz kolla_centos_train_rpm.tar.gz kolla_centos_train_rpm pip 依赖包 [root@kolla kolla_centos_train_whl]# cat requirements.txt setuptools==22.0.5 pip==20.3.4 wheel kolla-ansible==9.1.0 [root@kolla kolla_centos_train_whl]# mkdir packages [root@kolla kolla_centos_train_whl]# pip download -d packages -r requirements.txt [root@kolla kolla_centos_train_whl]# cat install.sh #!/bin/bash pip install --no-index --find-links=./packages/ setuptools==22.0.5 pip install --no-index --find-links=./packages/ pip==20.3.4 pip install --no-index --find-links=./packages/ wheel pip install --no-index --find-links=./packages/ kolla-ansible==9.1.0 --ignore-installed PyYAML [root@kolla ~]# tar cfz kolla_centos_train_whl.tar.gz kolla_centos_train_whl/
2023年05月06日
327 阅读
0 评论
0 点赞
2023-05-06
Deploy OpenStack offline based on Kolla
Deploy OpenStack offline based on Kolla 系统:CentOS Linux release 7.9.2009 (Core) 规格:4C8G 存储 50G 系统盘 20G 数据盘(cinder) 网络规划 ens33 仅主机(管理网、ip:192.168.100.10/24) ens34 NAT(业务网、CICR:192.168.10.0/24 、gw:192.168.10.2) VIP 192.168.100.100 初始化环境 1、修改主机名 hosts [root@kolla ~]# hostnamectl set-hostname kolla rabbitmq 可能需要能够进行主机名解析 2、配置网络 [root@kolla ~]# cat > /etc/sysconfig/network-scripts/ifcfg-ens34 <<EOF NAME=ens34 DEVICE=ens34 TYPE=Ethernet ONBOOT="yes" BOOTPROTO="none" EOF [root@kolla ~]# nmcli con reload && nmcli con up ens34 准备两块网卡、ens34 为 业务网络 3、上传软件包 99cloud_skyline.tar.gz // skyline 容器镜像 kolla_centos_train_min.tar.gz // 容器镜像(最小化) kolla_centos_train_rpm.tar.gz // 依赖软件包 kolla_centos_train_whl.tar.gz // pip依赖包 4、创建 lvm [root@kolla ~]# pvcreate /dev/sdb [root@kolla ~]# vgcreate cinder-volumes /dev/sdb 注:卷组名为 cinder_volume_group 参数 5、配置 源 配置 yum [root@kolla ~]# mkdir /etc/yum.repos.d/bak [root@kolla ~]# mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak [root@kolla ~]# tar xf kolla_centos_train_rpm.tar.gz -C /opt/ [root@kolla ~]# cat > /etc/yum.repos.d/local.repo << EOF [kolla] name=kolla - acha baseurl=file:///opt/kolla_centos_train_rpm/ gpgcheck=0 enabled=1 EOF 安装 依赖 [root@kolla ~]# yum install -y python-devel libffi-devel gcc openssl-devel \ libselinux-python python2-pip python-pbr ansible 安装常用软件 [root@kolla ~]# yum install -y vim unzip net-tools lrzsz tree bash-completion 部署环境 1、安装 kolla-ansible [root@kolla ~]# tar xf kolla_centos_train_whl.tar.gz [root@kolla ~]# cd kolla_centos_train_whl [root@kolla kolla_centos_train_whl]# ./install.sh 2、配置 准备配置文件 [root@kolla kolla_centos_train_whl]# mkdir -p /etc/kolla [root@kolla kolla_centos_train_whl]# cd /etc/kolla [root@kolla kolla]# chown $USER:$USER /etc/kolla [root@kolla kolla]# cp -r /usr/share/kolla-ansible/etc_examples/kolla/* /etc/kolla [root@kolla kolla]# cp /usr/share/kolla-ansible/ansible/inventory/* /etc/kolla 修改ansible配置文件 [root@kolla kolla]# cat << EOF | sed -i '/^\[defaults\]$/ r /dev/stdin' /etc/ansible/ansible.cfg host_key_checking=False pipelining=True forks=100 EOF 忽略 DeprecationWarning 提示 cat -n /usr/lib/python2.7/site-packages/ansible/parsing/vault/__init__.py | tail -n +41 | head -n 5 41 try: 42 #with warnings.catch_warnings(): 43 # warnings.simplefilter("ignore", DeprecationWarning) 44 warnings.filterwarnings("ignore") 45 from cryptography.exceptions import InvalidSignature 检查inventory [root@kolla /etc/kolla]# ansible -i all-in-one all -m ping 生成密码 [root@kolla kolla]# kolla-genpwd 修改 keystone_admin_password [root@kolla kolla]# sed -i 's#keystone_admin_password:.*#keystone_admin_password: kolla#g' /etc/kolla/passwords.yml [root@kolla kolla]# cat /etc/kolla/passwords.yml | grep keystone_admin_password keystone_admin_password: kolla 修改全局配置文件globals.yml(控制安装、配置组件) [root@kolla kolla]# cp /etc/kolla/globals.yml{,.bak} [root@kolla kolla]# cat >> /etc/kolla/globals.yml <<EOF # Kolla options kolla_base_distro: "centos" kolla_install_type: "binary" openstack_release: "train" kolla_internal_vip_address: "192.168.100.100" # Neutron - Networking Options network_interface: "ens33" neutron_external_interface: "ens34" neutron_plugin_agent: "openvswitch" enable_neutron_provider_networks: "yes" # OpenStack services enable_cinder: "yes" enable_cinder_backend_lvm: "yes" EOF 参数 说明 kolla_base_distro 容器镜像的 linux 发行版(ubuntu、centos、debain) kolla_install_type 组件构建类型(binary、source) openstack_release openstack 版本(train) kolla_internal_vip_address 高可用VIP(管理网地址) docker_registry Docker 镜像仓库 docker_namespace 镜像仓库所在命名空间(dockerhub 为 kolla) network_interface 管理网卡 neutron_external_interface 业务网卡 neutron_plugin_agent 网络插件(openvswitch,linuxbridge) enable_neutron_provider_networks 启用业务网络 enable_cinder 启用 cinder enable_cinder_backend_lvm 指定 cinder 后端存储(lvm) 3、部署 # 不启用 docker 源 [root@kolla kolla]# sed -i.bak "s/enable_docker_repo: true/enable_docker_repo: false/g" \ /usr/share/kolla-ansible/ansible/roles/baremetal/defaults/main.yml 忽略 docker版本 sed -i "9a \ \ ignore_errors: yes" \ /usr/share/kolla-ansible/ansible/roles/prechecks/tasks/service_checks.yml # 预配置,安装docker、docker sdk、关闭防火墙、配置时间同步等 [root@kolla kolla]# kolla-ansible -i ./all-in-one bootstrap-servers # 部署前检查环境 [root@kolla kolla]# kolla-ansible -i ./all-in-one prechecks # 导入镜像 [root@kolla kolla]# docker load -i /root/kolla_centos_train_min.tar.gz # 执行实际部署,运行对应组件容器 [root@kolla kolla]# kolla-ansible -i ./all-in-one deploy # 生成openrc文件 [root@kolla kolla]# kolla-ansible post-deploy 4、检查 [root@kolla kolla]# docker ps -a | grep -v Up [root@kolla kolla]# docker ps -a | wc -l 38 个容器 [root@kolla kolla]# lvs | grep cinder 安装 OpenStack 客户端 安装openstack客户端 [root@kolla kolla]# yum install -y python-openstackclient 运行 cirros 实例 [root@kolla kolla]# mkdir -p /opt/cache/files/ [root@kolla kolla]# mv cirros-0.4.0-x86_64-disk.img /opt/cache/files/ # 定义init-runonce示例脚本外部网络配置 [root@kolla kolla]# vim /usr/share/kolla-ansible/init-runonce EXT_NET_CIDR=${EXT_NET_CIDR:-'192.168.10.0/24'} EXT_NET_RANGE=${EXT_NET_RANGE:-'start=192.168.10.50,end=192.168.10.200'} EXT_NET_GATEWAY=${EXT_NET_GATEWAY:-'192.168.10.2'} # 执行脚本,上传镜像到glance,创建内部网络、外部网络、flavor、ssh key,并运行一个实例 [root@kolla kolla]# source /etc/kolla/admin-openrc.sh [root@kolla kolla]# /usr/share/kolla-ansible/init-runonce [root@kolla kolla]# openstack server create \ --image cirros \ --flavor m1.tiny \ --key-name mykey \ --network demo-net \ demo1 部署 Skyline [root@kolla ~]# database_password=`awk '/^database_password/ {print $2}' /etc/kolla/passwords.yml` [root@kolla ~]# docker exec -it mariadb mysql -uroot -p$database_password \ -e "CREATE DATABASE skyline DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; GRANT ALL PRIVILEGES ON skyline.* TO 'skyline'@'%' IDENTIFIED BY '000000';" [root@kolla ~]# docker exec -it mariadb mysql -uroot -p$database_password -e "show databases" | grep skyline [root@kolla ~]# docker exec -it mariadb mysql -uroot -p$database_password -e "select user,host from mysql.user;" | grep skyline [root@kolla ~]# source /etc/kolla/admin-openrc.sh [root@kolla ~]# openstack user create --domain default --password 000000 skyline +---------------------+----------------------------------+ | Field | Value | +---------------------+----------------------------------+ | domain_id | default | | enabled | True | | id | f437975f5b3e424382e4ac939274a92b | | name | skyline | | options | {} | | password_expires_at | None | +---------------------+----------------------------------+ [root@kolla ~]# openstack role add --project service --user skyline admin [root@kolla ~]# mkdir -p /etc/skyline /var/log/skyline /var/lib/skyline [root@kolla ~]# cat > /etc/skyline/skyline.yaml <<EOF default: database_url: 'mysql://skyline:000000@192.168.100.100:3306/skyline' prometheus_endpoint: 'http://localhost:9091' openstack: keystone_url: 'http://192.168.100.100:5000/v3' default_region: RegionOne interface_type: public system_user_name: 'skyline' system_user_password: '000000' EOF [root@kolla ~]# docker load -i /root/99cloud_skyline.tar.gz [root@kolla ~]# docker run -d --name skyline_bootstrap -e KOLLA_BOOTSTRAP="" \ -v /etc/skyline/skyline.yaml:/etc/skyline/skyline.yaml \ --net=host 99cloud/skyline:latest [root@kolla ~]# docker logs skyline_bootstrap + echo '/usr/local/bin/gunicorn -c /etc/skyline/gunicorn.py skyline_apiserver.main:app' + mapfile -t CMD ++ tail /run_command ++ xargs -n 1 + [[ -n 0 ]] + cd /skyline/libs/skyline-apiserver/ + make db_sync poetry run alembic upgrade head Skipping virtualenv creation, as specified in config file. /usr/local/lib/python3.8/dist-packages/pymysql/cursors.py:170: Warning: (1280, "Name 'alembic_version_pkc' ignored for PRIMARY key.") result = self._query(query) + exit 0 [root@kolla ~]# docker rm -f skyline_bootstrap [root@kolla ~]# docker run -d --name skyline \ --restart=always \ -v /etc/skyline/skyline.yaml:/etc/skyline/skyline.yaml \ --net=host \ 99cloud/skyline:latest
2023年05月06日
736 阅读
0 评论
0 点赞