目录

一、实验

1.环境

2.Linux 部署 OVN 集群(中心端)

3.Linux 部署 OVN 集群(业务端1)

4.Linux 部署 OVN 集群(业务端2)

4.OVN 中心端 连接数据库

5.OVN 业务端1 加⼊控制器

6.OVN 业务端2 加⼊控制器

7.OVN 集群查看

二、问题

1.南向控制器节点名称报错


一、实验

1.环境

(1) 主机

表1 主机

主机架构软件主要服务IP备注
ovn_central中心端

ovn-central

openvswitch

ovn-northd(控制平面层)

ovn-controller

192.168.204.64

ovn-nbctl(北向控制器)

ovn-sbctl(南向控制器)

ovn_node01业务端1

openvswitch

libvirt

ovn-controller

openvswitch

libvirtd

192.168.204.65

ovn_node02业务端2

openvswitch

libvirt

ovn-controller

openvswitch

libvirtd

192.168.204.66

(2) 修改hostname

ovs_central

hostnamectl set-hostname ovn_central && bash

ovn_node01

hostnamectl set-hostname ovn_node01 && bash

ovn_node02

hostnamectl set-hostname ovn_node02 && bash

(3) 修改hosts

vim /etc/hosts

① ovs_central

修改前:

修改后:

② ovn_node01

 修改前:

修改后:

③ ovn_node02

 修改前:

修改后:

2.Linux 部署 OVN 集群(中心端)

(1)查阅

1)官方安装文档
https://github.com/ovn-org/ovn/blob/main/Documentation/intro/install/general.rst

(2)删除旧repo

rm -rf /etc/yum.repos.d/*

(3)上传新repo

ls /etc/yum.repos.d/

(4)更新yum源

yum clean all && yum makecache

(5)更新内核

 yum upgrade -y --nogpgcheck

完成:

(6)安装软件包

yum install -y openssl-devel kernel-devel openvswitch openvswitch-devel openvswitch-ipsec openvswitch-test  openvswitch-ovn-common openvswitch-ovn-host libibverbs  --nogpgcheck

完成:

(7)启动服务

systemctl start openvswitch.service && systemctl enable openvswitch.service

(8)查看OVS

ovs-vsctl  show

(9)安装ovn-central

yum install -y ovn-central --nogpgcheck

(10)启动服务

systemctl start ovn-northd.service &&  systemctl enable  ovn-northd.service

systemctl start ovn-controller.service &&  systemctl enable  ovn-controller.service

北向进程ovn-northd.service

控制进程ovn-controller.service

(11)关闭防火墙并查看

关闭

systemctl stop firewalld && systemctl disable firewalld

查看

systemctl status firewalld

(12)验证

目前为空

ovn-nbctl  show
ovn-sbctl  show

(13)查看服务

systemctl list-units | grep -i ovn

(14)确认服务状态

systemctl  is-active ovn-northd.service
systemctl  is-active ovn-controller.service

3.Linux 部署 OVN 集群(业务端1)

(1) 删除旧repo

rm -rf /etc/yum.repos.d/*

(2)上传新repo

ls /etc/yum.repos.d/

(3)更新yum源

yum clean all && yum makecache

(4)更新内核

 yum upgrade -y --nogpgcheck

完成:

(5)安装软件包

yum install -y openssl-devel kernel-devel openvswitch openvswitch-devel openvswitch-ipsec openvswitch-test  openvswitch-ovn-common openvswitch-ovn-host libibverbs  --nogpgcheck

完成:

(6)启动服务

systemctl start openvswitch.service && systemctl enable openvswitch.service
systemctl start ovn-controller.service &&  systemctl enable  ovn-controller.service

 (7)查看OVS

ovs-vsctl  show

(8)确认服务状态

systemctl  is-active openvswitch.service
systemctl  is-active ovn-controller.service

(9) 关闭防火墙并查看

关闭

systemctl stop firewalld && systemctl disable firewalld

 查看

systemctl status firewalld

(10)安装libvirt

yum install -y qemu-kvm qemu-img virt-manager libvirt libvirt-python virt-manager libvirt-client virt-install virt-viewer --nogpgcheck

完成:

(11)启动libvirtd服务

 systemctl start libvirtd && systemctl enable libvirtd

4.Linux 部署 OVN 集群(业务端2)

 (1) 删除旧repo

rm -rf /etc/yum.repos.d/*

(2)上传新repo

ls /etc/yum.repos.d/

(3)更新yum源

yum clean all && yum makecache

(4)更新内核

 yum upgrade -y --nogpgcheck

完成:

(5)安装软件包

yum install -y openssl-devel kernel-devel openvswitch openvswitch-devel openvswitch-ipsec openvswitch-test  openvswitch-ovn-common openvswitch-ovn-host libibverbs  --nogpgcheck

完成:

(6)启动服务

systemctl start openvswitch.service && systemctl enable openvswitch.service
systemctl start ovn-controller.service &&  systemctl enable  ovn-controller.service

 (7)查看OVS

ovs-vsctl  show

(8)确认服务状态

systemctl  is-active openvswitch.service
systemctl  is-active ovn-controller.service

(9) 关闭防火墙并查看

关闭

systemctl stop firewalld && systemctl disable firewalld

 查看

systemctl status firewalld

(10)安装libvirt

yum install -y qemu-kvm qemu-img virt-manager libvirt libvirt-python virt-manager libvirt-client virt-install virt-viewer --nogpgcheck

完成:

(11)启动libvirtd服务

 systemctl start libvirtd && systemctl enable libvirtd

4.OVN 中心端 连接数据库

(1)监听OVN北向数据库

ovn-nbctl set-connection ptcp:6641:192.168.204.64

(2)监听OVN南向数据库

 ovn-sbctl set-connection ptcp:6642:192.168.204.64

(3)查看端口

netstat  -nltp | grep ovsdb-server 

5.OVN 业务端1 加⼊控制器

(1)加入控制器南向接口

ovs-vsctl set open . external-ids:ovn-remote=tcp:192.168.204.64:6642

(2)设置OVN系统ID

 ovs-vsctl set open . external-ids:system-id=node01

(3)设置OVN控制消息封装模式

ovs-vsctl set open . external-ids:ovn-encap-type=geneve

(4)设置OVN本地连接地址

ovs-vsctl set open . external-ids:ovn-encap-ip=192.168.204.65

(5)监听端口

netstat -antp | grep 6642

 (6)查看OVS

ovn_node01

ovs-vsctl show

已⾃动建⽴分布式全互联管理综合⽹桥br-int

6.OVN 业务端2 加⼊控制器

 (1)加入控制器南向接口

ovs-vsctl set open . external-ids:ovn-remote=tcp:192.168.204.64:6642

(2)设置OVN系统ID

 ovs-vsctl set open . external-ids:system-id=node02

(3)设置OVN控制消息封装模式

ovs-vsctl set open . external-ids:ovn-encap-type=geneve

(4)设置OVN本地连接地址

ovs-vsctl set open . external-ids:ovn-encap-ip=192.168.204.66

(5)监听端口

netstat -antp | grep 6642

(6)查看OVS

ovn_node02

ovs-vsctl show

已⾃动建⽴分布式全互联管理综合⽹桥br-int

7.OVN 集群查看

(1) 中心端查看北向控制器

目前为空

ovn-nbctl  show

(2) 中心端查看南向控制器

已更新

ovn-sbctl  show

(3)中心端监听OVN南向数据库

netstat -antp | grep 6642

(3)业务端查看隧道接⼝

ip link | grep gene

ovn_node01

ovn_node02

(4)业务端查看Geneve协议

ip -d link show  genev_sys_6081

ovn_node01

ovn_node02

(5)业务端查看Geneve端口

ovn_node01

ovn_node02

二、问题

1.南向控制器节点名称报错

(1)报错

 ovn_central

Chassis "a01fe9cb-463f-4d2d-b3bb-810b6a923a01"
……
Chassis "37752d67-f6d8-47b7-9ce0-248eb2c1f1fc"
……

 ovn_node01

……
Port "ovn-37752d-0"
……

 ovn_node02

……
Port "ovn-a01fe9-0"
……

(2)原因分析

系统重启后,OVN系统ID丢失。

(3)解决方法

设置OVN系统ID,名字显示为Chassis:

 ovn_node01

ovs-vsctl set open . external-ids:system-id=node01
ovs-vsctl  show

ovn_node02

ovs-vsctl set open . external-ids:system-id=node02
ovs-vsctl  show

 ovn_central

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐