Kolla 部署 Pike 版本的 OpenStack-多節點於平臺本節所講內容

準備 openstack 多結點實驗環境
安裝 kolla-ansible
自定義 kolla-ansible 安裝 openstack 的相關配置文件
開始基於 kolla-ansible 安裝 openstack 私有於
OpenStack 使用方法
查看創建好的 openstack 項目中的信息和於主機網絡連通性

準備 openstack 多結點實驗環境

準備硬件環境

新創建 3 臺虛擬機,分別作爲 controller 節點,compute 節點,storage 節點。其中 controller 節點 2 張網卡,compute、storage 節點各 1 張網卡。操作系統爲 centos7.5
注:controller 節點 也作爲安裝結點
主機名 IP 角色 內存 網卡類型
test63 192.168.1.63 controller 節點 8G ens33 和 ens38 都橋接
test64 192.168.1.64 compute 節點 4G ens33 橋接
test62 192.168.1.62 storage 節點 4G ens33 橋接
注:每個主機的 ens33 網卡作爲內部管理 openstack 的網絡和 web 界面的網絡接口。 controller 節點的 ens38 網卡作爲 對外的 網絡。 compute 和 storage 一張即可,因爲不需要 tunnel 網絡,直接使用 1 個網卡。
實驗拓撲圖:
在這裏插入圖片描述
test63 再添加 1 個網卡:兩個網卡都是橋接
在這裏插入圖片描述

準備 test62 存儲結點環境
只用一個網卡,storage 節點新加一塊磁盤,作爲 cinder 的 lvm 後端。內存使用 4G
在這裏插入圖片描述
test64 computer 結點,內存改成 4G,只用一個網卡
在這裏插入圖片描述

linux 系統環境配置

3 臺機器開始做刜始化配置, 以一下步驟需要在每一臺機器上操作
1、關閉 Selinux 和防火牆

[root@test63 ~]# vim /etc/selinux/config SELINUX=disabled
[root@test63 ~]# reboot #如果原來的系統開着 selinux,那麼需要重啓,才能關閉 selinux

2、關閉 Firewalld

[root@test63 ~]# systemctl stop firewalld && systemctl disable firewalld && systemctl status firewalld [root@test62 ~]# systemctl stop firewalld && systemctl disable firewalld && systemctl status firewalld [root@test64 ~]# systemctl stop firewalld && systemctl disable firewalld && systemctl status firewalld

3、安裝 Epel 源

[root@test63 ~]# mv /opt/CentOS-* /etc/yum.repos.d/   #這個在大家的機器上不需要執行。 因爲我的 centos 自帶的 yum 源配置文件,被移走了
[root@test63 ~]# yum install epel-release -y [root@test62 ~]# yum install epel-release -y [root@test64 ~]# yum  install epel-release –y

4、配置 Hostname

[root@test63 ~]# echo test63.cn > /etc/hostname [root@test62 ~]# echo test62.cn > /etc/hostname [root@test64 ~]# echo test64.cn > /etc/hostname

5、配置/etc/hosts

[root@test63 ~]# vim /etc/hosts
127.0.0.1	localhost localhost.localdomain localhost4 localhost4.localdomain4
::1	localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.1.63 test63.cn test63
192.168.1.64  test64.cn test64
192.168.1.62  test62.cn test62
[root@test63 ~]# scp /etc/hosts 192.168.1.64:/etc/ 
[root@test63 ~]# scp /etc/hosts 192.168.1.62:/etc/
注:hosts 文件中的短主機名,給 rabbitmq 使用的。 rabbitmq 服務會使用短主機域名

6、同步時間

[root@test63 ~]# yum install ntp -y && systemctl enable ntpd.service && systemctl start ntpd.service
[root@test62 ~]# yum install ntp -y && systemctl enable ntpd.service && systemctl start ntpd.service
[root@test64 ~]# yum install ntp -y && systemctl enable ntpd.service && systemctl start ntpd.service

7、配置 test63 上 pip 軟件包源,方便快速下載 python 庫(這一步很重要)

[root@test63 ~]# mkdir ~/.pip
[root@test63 ~]# vim /root/.pip/pip.conf #寫入下以內容
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/ [install]
trusted-host=mirrors.aliyun.com

配置 test63 網卡信息
生成 ens38 的網卡配置文件

[root@test63 ~]#cd /etc/sysconfig/network-scripts/ [root@test63 network-scripts]# cp ifcfg-ens33 ifcfg-ens38 [root@test63 network-scripts]# vim ifcfg-ens38 TYPE="Ethernet"
BOOTPROTO="none" NAME="ens38" DEVICE="ens38" ONBOOT="yes"

檢查一下 ens33 網卡配置文件,發現在新添加網卡,重啓系統後,啓動協議變了,現在改回來。

[root@test63 network-scripts]# vim ifcfg-ens33
改 :BOOTPROTO="dhcp" 爲:BOOTPROTO="none"
[root@test63 network-scripts]# service  network  restart 
查看網絡:
[root@test63 network-scripts]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.63 netmask 256.256.255.0 broadcast 192.168.1.255
。。。
ens38: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 #不用配置 IP
inet6 fe80::20c:29ff:fe49:1fe2 prefixlen 64 scopeid 0x20<link>

8.在 3 臺機器上安裝基礎包和 docker 服務
1、安裝基礎包和必要的一些系統工具,只在 test63 上操作,因爲 test63 是部署節點,這些包是安裝 kolla-ansible 必需要的。單純的 controller 節點,只需要安裝一個 docker 服務就可以了, 因爲 controller 需要的軟件包,都在 docker 鏡像中包括了,不需要再安裝軟件的。
注:test63 充當了兩個角色: kolla-ansible 部署節點, 和 controller 節點拓撲圖如下:
在這裏插入圖片描述


[root@test63 network-scripts]# yum install python-devel libffi-devel gcc openssl-devel git python-pip -y
[root@test63 ~]# pip install -U pip #升級一下 pip,不然後,後期安裝會報警告[root@test63 ~]# yum install -y yum-utils device-mapper-persistent-data lvm2 [root@test63 ~]# yum install ansible #安裝 ansible

2、添加 docker yum 源並安裝 docker 關閉 libvirtd 服務:

[root@test63 ~]# systemctl stop libvirtd.service && systemctl disable libvirtd.service && systemctl status libvirtd.service
[root@test62 ~]# systemctl stop libvirtd.service && systemctl disable libvirtd.service && systemctl status libvirtd.service
[root@test64 ~]# systemctl stop libvirtd.service && systemctl disable libvirtd.service && systemctl status libvirtd.service

如果有的話,卸載舊的 Docker,否則可能會不兼容:

[root@test63 ~]# yum remove docker docker-io docker-selinux python-docker-py [root@test62 ~]# yum remove docker docker-io docker-selinux python-docker-py [root@test64 ~]# yum remove   docker  docker-io docker-selinux python-docker-py 

因爲咱們 centos 默認安裝的是 docker 版本,而 kolla 使用的是 docker-ce 版本。
添加 docker-ce yum 源配置文件並安裝 docker

[root@test63 ~]# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo [root@test62 ~]# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo [root@test64 ~]# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

更新並安裝 Docker-CE 社區版本

[root@test63 ~]# yum -y install docker-ce [root@test62 ~]# yum -y install docker-ce [root@test64 ~]# yum -y install docker-ce

開啓 Docker 服務

[root@test63 ~]# systemctl start docker && systemctl enable docker && systemctl status docker [root@test62 ~]# systemctl start docker && systemctl enable docker && systemctl status docker [root@test64 ~]# systemctl start docker && systemctl enable docker && systemctl status docker

3、設置 3 臺服務器的 docker volume 卷掛載方式和 docker 鏡像加速器

[root@test63 ~]# mkdir /etc/systemd/system/docker.service.d
[root@test63 ~]# tee /etc/systemd/system/docker.service.d/kolla.conf << 'EOF' 
[Service]
MountFlags=shared EOF

設置 docker 鏡像加速器

[root@test63 ~]# vim /etc/docker/daemon.json
{
"registry-mirrors": ["https://e9yneuy4.mirror.aliyuncs.com"]
}
注:如果需要使用自己的本地私有倉庫,寫成如下:
{
"registry-mirrors": ["https://e9yneuy4.mirror.aliyuncs.com"]
"insecure-registries": ["192.168.1.63:4000"]
}

重啓相關服務

[root@test63 ~]# systemctl daemon-reload
[root@test63 ~]# systemctl enable docker && systemctl restart docker && systemctl status docker

test62 設置 volume 掛載方式

[root@test62 ~]#  mkdir  /etc/systemd/system/docker.service.d
[root@test62 ~]# tee /etc/systemd/system/docker.service.d/kolla.conf << 'EOF' 
[Service]
MountFlags=shared 
EOF

設置 docker 鏡像加速器

[root@test62 ~]# vim /etc/docker/daemon.json
{
"registry-mirrors": ["https://e9yneuy4.mirror.aliyuncs.com"]
}

重啓相關服務

[root@test62 ~]# systemctl daemon-reload
[root@test62 ~]# systemctl enable docker && systemctl restart docker && systemctl status docker

test64 設置 volume 掛載方式

[root@test64 ~]# mkdir /etc/systemd/system/docker.service.d
[root@test64 ~]# tee /etc/systemd/system/docker.service.d/kolla.conf << 'EOF' 
[Service]
MountFlags=shared 
EOF

設置 docker 鏡像加速器

[root@test64 ~]# vim /etc/docker/daemon.json
{
"registry-mirrors": ["https://e9yneuy4.mirror.aliyuncs.com"]
}

重啓相關服務

[root@test64 ~]# systemctl daemon-reload
[root@test64 ~]# systemctl enable docker && systemctl restart docker && systemctl status docker

test62 storage 配置 cinder 存儲信息

[root@test62 ~]# ls /dev/sdb
/dev/sdb
[root@test62 ~]# pvcreate /dev/sdb
Physical volume "/dev/sdb" successfully created.
[root@test62 ~]# vgcreate cinder-volumes /dev/sdb #創建一個名字爲cinder-volumes 的卷組,給後期 cinder 使用
Volume group "cinder-volumes" successfully created [root@test62 ~]# systemctl enable lvm2-lvmetad.service [root@test62 ~]# vgs
VG	#PV #LV #SN Attr	VSize	VFree cinder-volumes		1	0	0 wz--n- <20.00g <20.00g

到此 3 臺機器的基礎軟件包環境已經安裝好。

安裝 kolla-ansible

1、安裝 kolla-ansible
注:kolla-ansible 可以實現使用 ansible 自動安裝 docker

[root@test63 ~]# pip install kolla-ansible

注 : 官 方 推 薦 部 署 環 境 使 用 pip install kolla-ansible 方 式 來 安 裝 kolla-ansible https://docs.openstack.org/kolla-ansible/latest/user/quickstart.html #官方安裝手冊
2、複製 kolla-ansible 的相關配置文件

[root@test63 ~]# cp -r /usr/share/kolla-ansible/etc_examples/kolla /etc/ [root@test63 ~]# cp /usr/share/kolla-ansible/ansible/inventory/* /etc/kolla/ [root@test63 kolla-ansible]# ls /etc/kolla/
all-in-one    globals.yml    multinode   passwords.yml

注:all-in-one #安裝單節點 openstack 的 ansible 自動安裝配置文件,就是 ansible 主機清單文件multinode #安裝多節點 openstack 的 ansible 自動安裝配置文件,就是 ansible 主機清單文件globals.yml #部署 openstack 的自定義配置文件
passwords.yml #openstack 中各個服務的密碼
4、修改虛擬機類型爲 qemu
注:如果是在虛擬機裏裝 kolla,希望可以在虛擬機中再啓動虛擬機,那麼你需要把 virt_type=qemu,默認是 kvm。如果 vmware 開了“虛擬化 Intel VT”功能,就不用寫這個了。

在這裏插入圖片描述

[root@test63 kolla-ansible]# mkdir -p /etc/kolla/config/nova [root@test63 kolla-ansible]# cat << EOF > /etc/kolla/config/nova/nova-compute.conf
[libvirt]
virt_type=qemu cpu_mode = none 
EOF

自定義 kolla-ansible 安裝 openstack 的相關配置文件

1、自動生成 openstack 各服務的密碼文件

[root@test63 kolla-ansible]# kolla-genpwd [root@test63 ~]# vim /etc/kolla/passwords.yml
改:162 keystone_admin_password: HsPbEQHxTqmewKYNoRPpIOyQNdEYpHy36OX67TG3
爲:keystone_admin_password: 123456

注:這是登錄 Dashboard,admin 使用的密碼,你可以根據自己需要進行修改。
2、編輯 /etc/kolla/globals.yml 自定義 openstack 中部署事項

[root@test63 ~]# vim /etc/kolla/globals.yml #配置 openstack 安裝中的參數
改:15 #kolla_base_distro: "centos"       #選擇下載的鏡像爲基於 centos 版本的鏡像
爲 : kolla_base_distro: "centos"
改:18 #kolla_install_type: "binary"   #去了前面的#號,使用 yum 安裝二進制包安裝,源碼安裝,指的是使用 git clone 源碼安裝
爲 :18 kolla_install_type: "binary" 
改:21 #openstack_release: ""
爲:openstack_release: "pike"	#指定安裝 pike 版本的 openstack,後期下載的 openstack 相關的 docker 鏡像的 tag 標記也都爲 pike 
改:24 #node_custom_config: "/etc/kolla/config"	#配置文件的位置
爲:24 node_custom_config: "/etc/kolla/config"   #去了前面的#號,因爲我對 nova 節點做了自定義。如:我自定義 virt_type 虛擬化類型爲 qemu,默認是 kvm。

在這裏插入圖片描述

改:31 kolla_internal_vip_address: "10.10.10.254"
爲:31 kolla_internal_vip_address: "192.168.1.63"  #  我們沒有啓用高可用,所以這裏的 IP 可以和 ens33 一樣,也可以獨立寫一個和 ens33 同網段的 IP。
注:如果配置了高可用,這裏要使用一個沒被佔用的 IP。這個 IP 是搭建 HA 高可用的浮動 IP。 此 IP 將由 keepalived 管理以提供高可用性,應設置爲和 network_interface ens33 同一個網段的地址。
改:85 #network_interface: "eth0"
爲 : network_interface: "ens33" #設置 OpenStack 所以節點內部通信使用的網絡接口。這是 openstack 內部多個管理類型網絡的默認接口。這裏我們以 ens33 作爲內部通信網絡
改: 把前面的#號去了
89 #kolla_external_vip_interface: "{{ network_interface }}"
90 #api_interface: "{{ network_interface }}"
91 #storage_interface: "{{ network_interface }}" 
92 #cluster_interface: "{{ network_interface }}" 
93 #tunnel_interface: "{{ network_interface }}" 
94 #dns_interface: "{{ network_interface }}"
爲:
89 kolla_external_vip_interface: "{{ network_interface }}" 
90 api_interface: "{{ network_interface }}"
91 storage_interface: "{{ network_interface }}" 
92 cluster_interface: "{{ network_interface }}" 
93 tunnel_interface: "{{ network_interface }}" 
94 dns_interface: "{{ network_interface }}"
注:這樣所有內部通信網絡都走 network_interface ,即 ens33
改:100 #neutron_external_interface: "eth1"
爲:100 neutron_external_interface: "ens38"  # ens38 作爲外部網絡,所需的第二個接口專用於 Neutron 外部(或公共)網絡,可以是 vlan 或 flat,取決於網絡的創建方式。 此接口應在沒有 IP 地址的情況下處於活動  如果不是,於主機實例將無法訪問外部網絡。  所以 ens38 不能有 IP,只要網卡啓動着,就可以了。
改:150 #enable_cinder: "no"
爲:150 enable_cinder: "yes" #初除最前面的#號,並改 no 爲 yes。 啓用 cinder 
改:155 #enable_cinder_backend_lvm: "no"
 
爲:155 enable_cinder_backend_lvm: "yes" #初除最前面的#號,並改 no 爲 yes。cinder 後端用 lvm
改:167 #enable_haproxy: "yes"
爲:167 enable_haproxy: "no" #初除最前面的#號,並改 yes 爲 no。關閉高可用
改:319 #cinder_volume_group: "cinder-volumes"
爲:319 cinder_volume_group: "cinder-volumes"	#取消前面的#號,這個卷組的名字是我們在 test62 上創建的

在這裏插入圖片描述

開始基於 kolla-ansible 安裝 openstack 私有云

生成 SSH Key,並授信本節點:

[root@test63 ~]# ssh-keygen
[root@test63 ~]# ssh-copy-id -i ~/.ssh/id_rsa.pub root@test63 [root@test63 ~]# ssh-copy-id -i ~/.ssh/id_rsa.pub root@test62 [root@test63 ~]# ssh-copy-id -i ~/.ssh/id_rsa.pub root@test64

注:ssh-copy-id 複製公鑰時,後面要寫主機名,不要寫 IP。因爲後期 ansible 自動安裝節點,主機清單中寫的是主機名不是 IP。
配置 multinode 多結點清單文件

[root@test63 ~]# vim /etc/kolla/multinode	#修改成以下紅色標記內容
# These initial groups are the only groups required to be modified. The
# additional groups are for more control of the environment. [control]
# These hostname must be resolvable from your deployment host test63
# The above can also be specified as follows:
#control[01:03]	ansible_user=kolla
# The network nodes are where your l3-agent and loadbalancers will run
# This can be the same as a host in the control group [network]
test63
# inner-compute is the groups of compute nodes which do not have
# external reachability [inner-compute]
# external-compute is the groups of compute nodes which can reach
# outside
 
[external-compute] test64
[compute:children] inner-compute external-compute
[monitoring] test63
# When compute nodes and control nodes use different interfaces,
# you need to comment out "api_interface" and other interfaces from the global s.yml
# and specify like below:
#compute01 neutron_external_interface=eth0 api_interface=em1 storage_interface=em1 tunnel_interface=em1
[storage] test62
[deployment] test63

注:配置下面的內容不需要修改。裏面的內容很好理解,表示一個控制節點 controller,網絡節點也安裝到控制節點,一個計算節點 compute ,一個存儲節點 storage,後面的部分不用修改
開始部署 OpenStack
1、對主機進行預部署檢查:

[root@test63 kolla]# kolla-ansible -i /etc/kolla/multinode prechecks 報錯:
fatal: [test62]: FAILED! => {"changed": false, "cmd": ["/usr/bin/python", "-c", "import docker; print docker. version "],
。。。
, "ImportError: No module named docker"], "stdout": "", "stdout_lines": []}

在這裏插入圖片描述
解 決 : 在 test62 和 test64 上 執 行 :

[root@test64 ~]# pip uninstall docker [root@test64 ~]# pip uninstall docker-py
[root@test64 ~]# pip install -U docker --ignore-installed requests
 
[root@test63 ~]# kolla-ansible -i /etc/kolla/multinode prechecks  #再執行,出現以下界面說明檢測沒有問題

在這裏插入圖片描述
2、最後進入實際的 OpenStack 部署

[root@test63 ~]#    kolla-ansible -i /etc/kolla/multinode deploy     #因爲此時邊下載各種 openstack 相關的鏡像並部署 docker 實例,會比較慢。等待 30 分鐘左右。就可以了。我配置了 docker 鏡像加速結點,所以也會比較快

會先安裝 test63.
查看 test63 上的網絡連接:

[root@test63	kolla-ansible]# netstat	-antup	
tcp	0	32 192.168.1.63:33052	116.62.81.173:443	LAST_ACK	-
tcp	0	32 192.168.1.63:33116	116.62.81.173:443	LAST_ACK	-

[root@test63 kolla-ansible]# docker images	#查看下載的鏡像[root@test63 kolla-ansible]# docker ps #查看正在運行的 docker 實例

在這裏插入圖片描述

報錯總結:
如果安裝中運行 docker 實例報錯。
在這裏插入圖片描述
解決:

[root@test63 ~]#    kolla-ansible  -i /etc/kolla/multinode deploy	#重新執行一下就可以了

在這裏插入圖片描述
到此安裝成功。
3、驗證部署

[root@test63 ~]# kolla-ansible post-deploy -i /etc/kolla/multimode

在這裏插入圖片描述
這樣就創建 /etc/kolla/admin-openrc.sh 文件

[root@test63 kolla]# ll /etc/kolla/admin-openrc.sh
-rw-r--r-- 1  root  root  323 8 月  10 17:58  /etc/kolla/admin-openrc.sh [root@test63  kolla]# cat /etc/kolla/admin-openrc.sh	##查看 openstack 登錄帳號export OS_PROJECT_DOMAIN_NAME=Default
export OS_USER_DOMAIN_NAME=Default export OS_PROJECT_NAME=admin
export OS_TENANT_NAME=admin export OS_USERNAME=admin
export OS_PASSWORD=123456 #帳號和密碼

4、測試:http://192.168.1.63 訪問成功。
在這裏插入圖片描述
裏面沒有任何東西
在這裏插入圖片描述

OpenStack 使用方法

安 裝 OpenStack client 端 , 方 便 後 期 使 用 命 令 行 操 作 openstack

[root@test63 ~]# pip install python-openstackclient python-glanceclient python-neutronclient 
注:軟件包的作用:
python-openstackclient #openstack 客戶端
python-glanceclient     #操作 glance 鏡像存儲命令
python-neutronclient   #操作 openstack 網絡相關的命令報錯:已經安裝 PyYAML 3.10,但是我們需要 PyYAML
Found existing installation: PyYAML 3.10
Cannot uninstall 'PyYAML'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
[root@test63 ~]# pip install PyYAML --ignore-installed PyYAML #忽略安裝的PyYAML,進行安裝
[root@test63 ~]# pip install python-openstackclient	#再次安裝

報錯:

Found existing installation: ipaddress 1.0.16
Cannot uninstall 'ipaddress'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
[root@test63 ~]# pip install ipaddress --ignore-installed ipaddress [root@test63 ~]# pip install python-openstackclient
[root@test63 ~]# pip install python-neutronclient  # 報錯,提示已經安裝 pyinotify
[root@test63 ~]# pip install pyinotify --ignore-installed pyinotify

修改 init-runonce

init-runonce 是在 openstack 中快速創建一個於項目例子的腳本

[root@test63 ~]# vim /usr/share/kolla-ansible/init-runonce	#網絡需要根據實際情況修改
改:
12 EXT_NET_CIDR='10.0.2.0/24'
13 EXT_NET_RANGE='start=10.0.2.150,end=10.0.2.199'
14 EXT_NET_GATEWAY='10.0.2.1'
爲 : 
EXT_NET_CIDR='192.168.1.0/24'
EXT_NET_RANGE='start=192.168.1.230,end=192.168.1.240' EXT_NET_GATEWAY='192.168.1.1'

注:192.168.1.0 的網絡,就是我上面 ens38 接入的局域網中的地址,這個網絡是通過局域網絡中的路由器訪問虧聯網。配置好這個,裝完虛擬機就可以直接 ping 通。

使用 init-runonce 腳本創建一個 openstack 於項目

1、開始創建一個於項目

[root@test63 ~]# source /etc/kolla/admin-openrc.sh   #必須先加載這個文件,把文件中的環境變量加入系統中,纔有權限執行下面的命令
[root@test63 ~]# cd /usr/share/kolla-ansible 
[root@test63 kolla-ansible]# ./init-runonce #最後彈出以下

在這裏插入圖片描述

在 openstack 中創建一個虛擬機

[root@test63 kolla-ansible]# openstack server create --image cirros --flavor m1.tiny --key-name mykey --nic net-id=a60a94b3-d1da-44c3-9c35-7505e1411378 demo1

注:a60a94b3-d1da-44c3-9c35-7505e1411378 這個是前面彈出的 ID

查看創建好的 openstack 項目中的信息和於主機網絡連通性

查看網絡信息:

[root@test63 ~]# source   /etc/kolla/admin-openrc.sh    #要讀一下這個環境變量配置文件。不然後,後期在執行命令時,會報如下錯:
Missing value auth-url required for auth plugin password [root@test63 ~]# openstack router list #查看路由信息
[root@test63 ~]# openstack  router show demo-router	#查看 demo-router 路由信息[root@test63 ~]# openstack network list	#查看網絡信息
[root@test63 ~]# openstack server show demo1 #查看名字爲 demo1 的虛擬機信息

在這裏插入圖片描述
把創建的實例於主機,路由,網絡都初除,一會我們自己手動創建
初除網絡時,要在“管理員”菜單下初除
在這裏插入圖片描述

實戰-通過命令行來創建自己的網絡拓撲圖

1、首先 source openers.sh 腳本,該腳本中是一些環境變量: 運行該腳本,即可通過命令行來管理於資源了:

[root@test63 ~]#    source /etc/kolla/admin-openrc.sh 

2、創建對外的公網,名字:public

[root@test63 ~]# openstack network create --external --provider-physical-network physnet1 --provider-network-type flat public

3、給 public 網絡添加子網:

[root@test63 ~]# openstack subnet create --no-dhcp --allocation-pool 'start=192.168.1.230,end=192.168.1.240' --network public --subnet-range 192.168.1.0/24 --gateway 192.168.1.1 public-subnet

4、創建私有網絡:

[root@test63 ~]# openstack network create --provider-network-type vxlan demo-net
 

給私有網絡添加子網:

[root@test63 ~]# openstack subnet create --subnet-range 10.0.0.0/24 --network demo-net --gateway 10.0.0.1 --dns-nameserver 8.8.8.8 demo-subnet

5、給外網和私網乊間添加路由:

[root@test63 ~]# openstack router create demo-router
[root@test63 ~]# openstack router add subnet demo-router demo-subnet 
[root@test63 ~]# openstack router set --external-gateway public demo-router

6、通過下面的命令可以查詢剛剛所建的網絡信息

[root@test63 ~]# neutron net-list

7、登到 dashboard 上面去看 network topology:
在這裏插入圖片描述
至此,使用命令行創建的網絡拓撲結束。
網絡拓撲必須在命令行下運行,在 web 界面創建的網絡拓撲圖,上不了外網。因爲在網頁上無法設置橋接到物理網絡上。命令行下有這一步驟:
在這裏插入圖片描述
創建一個臺於主機及其他操作,在 web 界面執行就可以了。
在這裏插入圖片描述
在這裏插入圖片描述
安全組和密鑰對,使用默認的就可以了
在這裏插入圖片描述
在這裏插入圖片描述
在這裏插入圖片描述
點創建。
分配浮動 IP 地址:
在這裏插入圖片描述
在這裏插入圖片描述
給於主機綁定浮動 IP
在這裏插入圖片描述
在這裏插入圖片描述

開始測試:

[root@test63 ~]# ping 192.168.1.235 # 可 以 ping 通PING 192.168.1.235 (192.168.1.235) 56(84) bytes of data.
64 bytes from 192.168.1.235: icmp_seq=1 ttl=63 time=16.5 ms

直接在物理機上進入於主機

[root@test63 ~]# ssh [email protected]
$
$ ping baidu.com
PING baidu.com (220.181.57.216): 56 data bytes
64 bytes from 220.181.57.216: seq=0 ttl=50 time=18.559 ms 64 bytes from 220.181.57.216: seq=1 ttl=50 time=13.400 ms

總結

Kolla 概述和 openstack 所有結點 linux 系統刜始配置
openstack 所有結點 linux 系統刜始配置
安裝 kolla-ansible
自定義 kolla-ansible 安裝 openstack 的相關配置文件
開始基於 kolla-ansible 安裝 openstack 私有於
OpenStack 使用方法
查看創建好的 openstack 項目中的信息和於主機網絡連通性
實戓-通過命令行來創建自己的網絡拓撲圖

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章