环境准备
我这里用workstation
创建了一个虚拟机,安装centos7.5 mini
系统,这台虚拟机上有两张网卡,一张做openstack管理网,一张做为虚拟机的业务网卡。
我用来测试的VM配置是4C,8G,100G
如果想运行ubuntu cloud images的话最好是8C,16G,100G的配置,当然~~如果你用cirros的话那就随意咯!
基本信息如下
<table><tr><td bgcolor=orange> 背景色是 1 orange</td></tr></table>
[root@queens ~]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
[root@queens ~]# uname -r
3.10.0-862.el7.x86_64
[root@queens ~]# egrep '(vmx|svm)' /proc/cpuinfo
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc eagerfpu pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch tpr_shadow vnmi ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 invpcid rtm rdseed adx smap xsaveopt ibpb ibrs stibp arat spec_ctrl intel_stibp arch_capabilities
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc eagerfpu pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch tpr_shadow vnmi ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 invpcid rtm rdseed adx smap xsaveopt ibpb ibrs stibp arat spec_ctrl intel_stibp arch_capabilities
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc eagerfpu pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch tpr_shadow vnmi ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 invpcid rtm rdseed adx smap xsaveopt ibpb ibrs stibp arat spec_ctrl intel_stibp arch_capabilities
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc eagerfpu pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch tpr_shadow vnmi ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 invpcid rtm rdseed adx smap xsaveopt ibpb ibrs stibp arat spec_ctrl intel_stibp arch_capabilities
[root@queens ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:50:56:87:a6:a5 brd ff:ff:ff:ff:ff:ff
inet 192.168.6.50/24 brd 192.168.6.255 scope global ens192
valid_lft forever preferred_lft forever
inet6 fe80::250:56ff:fe87:a6a5/64 scope link
valid_lft forever preferred_lft forever
3: ens224: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master ovs-system state UP group default qlen 1000
link/ether 00:50:56:87:7f:15 brd ff:ff:ff:ff:ff:ff
inet6 fe80::250:56ff:fe87:7f15/64 scope link
valid_lft forever preferred_lft forever
ens192网卡配置了IP地址,ens224什么都没有配置
[root@queens ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens192
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
IPADDR=192.168.6.53
PREFIX=24
GATEWAY=192.168.6.1
DNS1=114.114.114.114
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
NAME=ens192
UUID=8dd201c9-3c8e-4a01-824c-37f84d6814dd
DEVICE=ens192
ONBOOT=yes
[root@queens ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens224
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
NAME=ens224
DEVICE=ens224
ONBOOT=yes
开始配置
echo queens > /etc/hostname
ipa="$(ip a show ens192 | grep ens192 | grep global | awk '{print $2}' | awk -F/ '{print $1}')"
echo -e "$ipa\tqueens" >> /etc/hosts
systemctl stop NetworkManager
systemctl disable NetworkManager
systemctl stop firewalld
systemctl disable firewalld
sed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/config
setenforce 0
getenforce
yum install -y epel-release
yum install -y ansible axel vim git curl wget lrzsz gcc python-devel python-pip docker-ce
yum install -y iperf sysstat nload net-tools dstat blktrace fio tcpdump ltrace lsof iptraf lshw cpuid numactl mdadm lsscsi sysbench mtr vnstat collectl iftop trafshow nethogs man strace perf iotop atop hping3 systemtap nmon htop bwm-ng glances usbutils pciutils util-linux-ng smartmontools #这个是一些常用软件,完全不用安装,个人习惯而已
reboot
重启完成后,继续配置
wget -O /etc/yum.repos.d/docker-ce.repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
pip install --upgrade pip
mkdir /etc/systemd/system/docker.service.d
tee /etc/systemd/system/docker.service.d/kolla.conf << 'EOF'
[Service]
MountFlags=shared
EOF
sed -i '13d' /usr/lib/systemd/system/docker.service
sed -i '12a ExecStart=/usr/bin/dockerd --registry-mirror=https://ebu037tr.mirror.aliyuncs.com --storage-driver=overlay2 ' /usr/lib/systemd/system/docker.service
systemctl daemon-reload
systemctl restart docker
systemctl enable docker
systemctl status docker
docker info
git clone https://github.com/openstack/kolla-ansible -b stable/queens
cd kolla-ansible/
cp -r etc/kolla/ /etc/kolla/
pip install . -i https://pypi.tuna.tsinghua.edu.cn/simple
kolla-genpwd
sed -i '/keystone_admin_password:/c\keystone_admin_password: password' /etc/kolla/passwords.yml
cat /etc/kolla/passwords.yml | grep keystone_admin_password
cp /etc/kolla/globals.yml /etc/kolla/globals.yml.bak
ipa="$(ip a show ens192 | grep ens192 | grep global | awk '{print $2}' | awk -F/ '{print $1}')"
sed -i '/kolla_base_distro:/c\kolla_base_distro: "centos"' /etc/kolla/globals.yml
sed -i '/kolla_install_type:/c\kolla_install_type: "source"' /etc/kolla/globals.yml
sed -i '/openstack_release:/c\openstack_release: "queens"' /etc/kolla/globals.yml
sed -i '/docker_namespace:/c\docker_namespace: "kolla"' /etc/kolla/globals.yml
sed -i '/network_interface:/c\network_interface: "ens192"' /etc/kolla/globals.yml
sed -i '/neutron_external_interface:/c\neutron_external_interface: "ens224"' /etc/kolla/globals.yml
sed -i '/enable_haproxy:/c\enable_haproxy: "no"' /etc/kolla/globals.yml
sed -i '/nova_compute_virt_type:/c\nova_compute_virt_type: "qemu"' /etc/kolla/globals.yml
sed -i "s/\(^kolla_internal_vip_address:\).*/\1 \"${ipa}\"/" /etc/kolla/globals.yml
配置完之后检查下
[root@queens ~]# egrep "^[^#]" /etc/kolla/globals.yml
---
kolla_base_distro: "centos"
kolla_install_type: "source"
openstack_release: "queens"
kolla_internal_vip_address: "192.168.6.50"
docker_namespace: "kolla"
network_interface: "ens192"
neutron_external_interface: "ens224"
enable_haproxy: "no"
nova_compute_virt_type: "qemu"
ironic_dnsmasq_dhcp_range:
tempest_image_id:
tempest_flavor_ref_id:
tempest_public_network_id:
tempest_floating_network_name:
快照,快照,快照
一定记得给虚机做个快照,一定记得给虚机做个快照,一定记得给虚机做个快照。
pull镜像并部署
kolla-ansible prechecks
kolla-ansible pull
kolla-ansible deploy
kolla-ansible post-deploy
pip install --ignore-installed ipaddress PyYAML
pip install python-openstackclient
[option]可选执行
如果安装python-openstackclient出现错误可以临时指定pip源来重新执行python-openstackclient的安装,可以试下下面的命令
pip install -i https://pypi.mirrors.ustc.edu.cn/simple/ python-openstackclient
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple python-openstackclient
[option]可选执行
如果想安装其他的client,请执行以下命令
pip install python-PROJECTclient
请把PROJECT换成cinder或者glance等等等等等等
barbican - Key Manager Service API
ceilometer - Telemetry API
cinder - Block Storage API and extensions
cloudkitty - Rating service API
designate - DNS service API
fuel - Deployment service API
glance - Image service API
gnocchi - Telemetry API v3
heat - Orchestration API
magnum - Container Infrastructure Management service API
manila - Shared file systems API
mistral - Workflow service API
monasca - Monitoring API
murano - Application catalog API
neutron - Networking API
nova - Compute API and extensions
senlin - Clustering service API
swift - Object Storage API
trove - Database service API
sed -i.bak "s@\(^EXT_NET_CIDR=\).*@\1='10.10.20.0/24'@g" /usr/share/kolla-ansible/init-runonce
sed -i.bak "s@\(^EXT_NET_RANGE=\).*@\1='start=10.10.20.110,end=10.10.20.254'@g" /usr/share/kolla-ansible/init-runonce
sed -i.bak "s@\(^EXT_NET_GATEWAY=\).*@\1='10.10.20.1'@g" /usr/share/kolla-ansible/init-runonce
[root@queens ~]# cat /usr/share/kolla-ansible/init-runonce | grep ^EXT_NET
EXT_NET_CIDR='10.10.20.0/24'
EXT_NET_RANGE='start=10.10.20.110,end=10.10.20.254'
EXT_NET_GATEWAY='10.10.20.1'
source /etc/kolla/admin-openrc.sh
cd /usr/share/kolla-ansible/ && ./init-runonce
由于错误的出现,可能需要多次的部署,而有些错误重新部署是不会进行修正的,所以需要将整个环境进行清理:
tools/cleanup-containers #可用于从系统中移除部署的容器
tools/cleanup-host #可用于移除由于残余网络变化引发的docker启动的neutron-agents主机
tools/cleanup-images #可用于从本地缓存中移除所有的docker image
登录配置OpenStack
此时就可以访问自己的IP地址了
使用浏览器访问Dashboard
,我这里地址就是192.168.6.50
用户名为admin
密码为password
1.登录之后需要自己创建实例类型
2.自己创建网络
、子网
、路由器
3.导入镜像
可以参考https://www.cnblogs.com/tcicy/p/10306306.html
4.创建实例
目前还有个问题,就是我还不知道怎么给虚拟机分配浮动IP地址
,没有浮动IP地址
的话就没有办法让外部网络设备直接访问ubuntu cloud images instance 18.04.
不过经过这个过程,已经搭建完成OpenStack,比起以前的版本来说那可是相当的简单简洁了。
后面开始你们的表演。
如果有问题可以直接网站内消息
或者tcicy#126.com
顺便说下Markdown
真香