1.集群架构
其中e1,e2,e3 表示网卡。
e1 所在网络为管理网。
e2 为vm对外通信网卡,无需配置网络协议和ip地址:
BOOTPROTO=none DEVICE=eth1 HWADDR=fa:16:3e:38:20:88 ONBOOT=yes TYPE=Ethernet USERCTL=no ....
e3所在网络为osd集群通信网络
备注:操作系统为centos7.4 最小化安装
2. kolla容器化部署openstack及ceph集群
2.1 基础环境
以下操作在部署机执行 #1.epel yum install epel-release #2.防火墙 systemctl stop firewalld && systemctl disable firewalld && systemctl status firewalld sed -i‘‘ ‘s,SELINUX=enforcing,SELINUX=disabled,g‘ /etc/selinux/config setenforce 0 3.修改/etc/hosts 及配置免秘钥登录 10.0.100.11 controller1 10.0.100.12 controller2 10.0.100.13 controller3 10.0.100.21 network1 10.0.100.22 network2 10.0.100.31 compute1 10.0.100.32 compute2 10.0.100.33 compute3 10.0.100.34 compute4 10.0.100.35 compute5 ssh-keygen ssh-copy-id controller1 .... #4 python及pip环境 yum install -y python2-pip cat <<EOF> /etc/pip.conf [global] index-url = http://mirrors.aliyun.com/pypi/simple/ [install] trusted-host=mirrors.aliyun.com EOF yum install -y python-devel libffi-devel gcc openssl-devel libselinux-python git ansible git #5.准备docker环境 yum remove docker docker-common docker-selinux docker-engine yum install -y yum-utils device-mapper-persistent-data lvm2 wget -O /etc/yum.repos.d/docker-ce.repo https://download.docker.com/linux/centos/docker-ce.repo sed -i ‘s+download.docker.com+mirrors.tuna.tsinghua.edu.cn/docker-ce+‘ /etc/yum.repos.d/docker-ce.repo yum clean all yum makecache fast yum install docker-ce mkdir /etc/docker/ cat << EOF>/etc/docker/daemon.json { "registry-mirrors": ["https://iby0an85.mirror.aliyuncs.com"] } EOF systemctl daemon-reload systemctl start docker 6.安装kolla-ansible yum install python2-pip cat <<EOF> /etc/pip.conf [global] index-url = http://mirrors.aliyun.com/pypi/simple/ [install] trusted-host=mirrors.aliyun.com EOF pip install -U pip pip install -U ‘ansible>=2.2.0‘ yum install -y python-devel libffi-devel gcc openssl-devel libselinux-python git git clone https://github.com/openstack/kolla-ansible -b stable/rocky cd kolla-ansible pip install -r requirements python setup.py install 7.启动registry(此处我已将rocky的版本的registry打包 tar -xzvf rocky.tar.gz -C / docker run -d -p 4000:5000 -v /opt/registry/:/var/lib/registry/ --restart=always --name=registry registry:2 # 查看容器运行 docker ps docker inspect containerID
2.2 部署openstack/ceph集群
1.准备配置文件 cd /root/kolla-ansible cp etc/kolla/globals.yml /etc/kolla/ cp etc/kolla/passwords.yml /etc/kolla/ kolla-genpwd # 2. 修改admin密码: vim /etc/kolla/passwords.yml keystone_admin_password: otvcloud #3.编辑 globals.yml(重点 基本要掌握每个参数的意思) vim /etc/kolla/globals.yml ############### # Valid options are [ COPY_ONCE, COPY_ALWAYS ] config_strategy: "COPY_ALWAYS" # Valid options are [‘centos‘, ‘debian‘, ‘oraclelinux‘, ‘rhel‘, ‘ubuntu‘] kolla_base_distro: "centos" # Valid options are [ binary, source ] kolla_install_type: "binary" # Valid option is Docker repository tag openstack_release: "rocky" # Location of configuration overrides node_custom_config: "/etc/kolla/config" kolla_internal_vip_address: "10.100.2.11" # 外网接口 管理网一个没有使用ip docker_registry: "10.100.2.10:4000" # 上面构建的docker registy的ip地址 docker_namespace: "lokolla" network_interface: "e1" # 管理网口 api_interface: "{{ network_interface }}" storage_interface: "{{ network_interface }}" cluster_interface: "e3" # osd集群网络 tunnel_interface: "{{ network_interface }}" neutron_external_interface: "e2" # 外部通信网卡 neutron_plugin_agent: "openvswitch" keepalived_virtual_router_id: "51" openstack_logging_debug: "True" # Valid options are [ none, novnc, spice, rdp ] nova_console: "novnc" # OpenStack services can be enabled or disabled with these options enable_central_logging: "yes" enable_ceph: "yes" enable_chrony: "yes" enable_cinder: "yes" enable_cinder_backup: "yes" enable_collectd: "yes" enable_haproxy: "yes" enable_heat: "no" enable_horizon: "yes" enable_influxdb: "yes" enable_neutron_dvr: "yes" enable_neutron_agent_ha: "yes" # keystone keystone_token_provider: ‘fernet‘ fernet_token_expiry: 86400 # glance glance_backend_ceph: "yes" glance_enable_rolling_upgrade: "no" #cinder cinder_backend_ceph: "yes" cinder_backup_driver: "ceph" #nova nova_backend_ceph: "yes" # Valid options are [ qemu, kvm, vmware, xenapi ] nova_compute_virt_type: "kvm" #tenant network neutron_tenant_network_types: "vlan" #4.编辑multinode cp /root/kolla-ansible/ansible/inventory/multinode /root/ vim multinode [control] # These hostname must be resolvable from your deployment host controller1 controller2 controller3 [network] network1 network2 [external-compute] compute1 compute2 .... [monitoring] controller1 [storage] compute1 compute2 ..... 5.标记osd节点 使用bluestore,此处在osd节点上执行 例如compute1节点 的osd节点 parted disk -s -- mklabel gpt mkpart KOLLA_CEPH_OSD_BOOTSTRAP_BS 1 -1 # filestore 则为 KOLLA_CEPH_OSD_BOOTSTRAP parted disk -s -- print 6. 初始化环境 kolla-ansible -i multinode bootstrap-servers #除部署机之外所有机器reboot reboot kolla-ansible -i multinode prechecks #检测 kolla-ansible -i deploy # 开始部署 kolla-ansible -i post-deploy # 生成admin-openrc.sh cp /etc/kolla/admin-openrc.sh admin-openrc.sh chmod +x admin-openrc.sh
2.3 验证
安装客户端 yum install centos-release-openstack-pike yum makecache fast yum install -y python-openstackclient cp /root/kolla-ansible/tools/init-runonce /root/ vim init-runonce # 注释掉 demo网络和创建路由部分, 外部网络创建flat改成vlan模式 openstack network create --external --provider-physical-network physnet1 --provider-network-type vlan public1 openstack subnet create --no-dhcp --allocation-pool ${EXT_NET_RANGE} --network public1 --subnet-range ${EXT_NET_CIDR} --gateway ${EXT_NET_GATEWAY} public1-subnet #openstack network create --provider-network-type vxlan demo-net #openstack subnet create --subnet-range 172.17.6.0/24 --network demo-net --gateway 172.17.6.1 --dns-nameserver 8.8.8.8 demo-subnet #openstack router create demo-router #openstack router add subnet demo-router demo-subnet #openstack router set --external-gateway public1 demo-router To deploy a demo instance, run: openstack server create \--image ${IMAGE_NAME} \--flavor m1.tiny \--key-name mykey \--network public1 \vm1 # ceph 验证 controller1: docker exec ceph_mon ceph -s # volume 验证 openstack volume create --size 1 volume1 openstack server vm1 volume1
欢迎加入OpenStack技术交流群进行交流,群号:791930493 。入群二维码:
也可以关注微信公众号:启航学城,干货满满,扫码关注:
原文地址:https://www.cnblogs.com/jonc/p/11106203.html
时间: 2024-10-09 05:33:42