目录
[2.Linux 部署 OVN 集群(中心端)](#2.Linux 部署 OVN 集群(中心端))
[3.Linux 部署 OVN 集群(业务端1)](#3.Linux 部署 OVN 集群(业务端1))
[4.Linux 部署 OVN 集群(业务端2)](#4.Linux 部署 OVN 集群(业务端2))
[4.OVN 中心端 连接数据库](#4.OVN 中心端 连接数据库)
[5.OVN 业务端1 加⼊控制器](#5.OVN 业务端1 加⼊控制器)
[6.OVN 业务端2 加⼊控制器](#6.OVN 业务端2 加⼊控制器)
[7.OVN 集群查看](#7.OVN 集群查看)
一、实验
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
bash
hostnamectl set-hostname ovn_central && bash
ovn_node01
bash
hostnamectl set-hostname ovn_node01 && bash
ovn_node02
bash
hostnamectl set-hostname ovn_node02 && bash
(3) 修改hosts
bash
vim /etc/hosts
① ovs_central
修改前:
修改后:
② ovn_node01
修改前:
修改后:
③ ovn_node02
修改前:
修改后:
2.Linux 部署 OVN 集群(中心端)
(1)查阅
bash
1)官方安装文档
https://github.com/ovn-org/ovn/blob/main/Documentation/intro/install/general.rst
(2)删除旧repo
bash
rm -rf /etc/yum.repos.d/*
(3)上传新repo
bash
ls /etc/yum.repos.d/
(4)更新yum源
bash
yum clean all && yum makecache
(5)更新内核
bash
yum upgrade -y --nogpgcheck
完成:
(6)安装软件包
bash
yum install -y openssl-devel kernel-devel openvswitch openvswitch-devel openvswitch-ipsec openvswitch-test openvswitch-ovn-common openvswitch-ovn-host libibverbs --nogpgcheck
完成:
(7)启动服务
bash
systemctl start openvswitch.service && systemctl enable openvswitch.service
(8)查看OVS
bash
ovs-vsctl show
(9)安装ovn-central
bash
yum install -y ovn-central --nogpgcheck
(10)启动服务
bash
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)关闭防火墙并查看
关闭
bash
systemctl stop firewalld && systemctl disable firewalld
查看
bash
systemctl status firewalld
(12)验证
目前为空
bash
ovn-nbctl show
ovn-sbctl show
(13)查看服务
bash
systemctl list-units | grep -i ovn
(14)确认服务状态
bash
systemctl is-active ovn-northd.service
systemctl is-active ovn-controller.service
3.Linux 部署 OVN 集群(业务端1)
(1) 删除旧repo
bash
rm -rf /etc/yum.repos.d/*
(2)上传新repo
bash
ls /etc/yum.repos.d/
(3)更新yum源
bash
yum clean all && yum makecache
(4)更新内核
bash
yum upgrade -y --nogpgcheck
完成:
(5)安装软件包
bash
yum install -y openssl-devel kernel-devel openvswitch openvswitch-devel openvswitch-ipsec openvswitch-test openvswitch-ovn-common openvswitch-ovn-host libibverbs --nogpgcheck
完成:
(6)启动服务
bash
systemctl start openvswitch.service && systemctl enable openvswitch.service
systemctl start ovn-controller.service && systemctl enable ovn-controller.service
(7)查看OVS
bash
ovs-vsctl show
(8)确认服务状态
bash
systemctl is-active openvswitch.service
systemctl is-active ovn-controller.service
(9) 关闭防火墙并查看
关闭
bash
systemctl stop firewalld && systemctl disable firewalld
查看
bash
systemctl status firewalld
(10)安装libvirt
bash
yum install -y qemu-kvm qemu-img virt-manager libvirt libvirt-python virt-manager libvirt-client virt-install virt-viewer --nogpgcheck
完成:
(11)启动libvirtd服务
bash
systemctl start libvirtd && systemctl enable libvirtd
4.Linux 部署 OVN 集群(业务端2)
(1) 删除旧repo
bash
rm -rf /etc/yum.repos.d/*
(2)上传新repo
bash
ls /etc/yum.repos.d/
(3)更新yum源
bash
yum clean all && yum makecache
(4)更新内核
bash
yum upgrade -y --nogpgcheck
完成:
(5)安装软件包
bash
yum install -y openssl-devel kernel-devel openvswitch openvswitch-devel openvswitch-ipsec openvswitch-test openvswitch-ovn-common openvswitch-ovn-host libibverbs --nogpgcheck
完成:
(6)启动服务
bash
systemctl start openvswitch.service && systemctl enable openvswitch.service
systemctl start ovn-controller.service && systemctl enable ovn-controller.service
(7)查看OVS
bash
ovs-vsctl show
(8)确认服务状态
bash
systemctl is-active openvswitch.service
systemctl is-active ovn-controller.service
(9) 关闭防火墙并查看
关闭
bash
systemctl stop firewalld && systemctl disable firewalld
查看
bash
systemctl status firewalld
(10)安装libvirt
bash
yum install -y qemu-kvm qemu-img virt-manager libvirt libvirt-python virt-manager libvirt-client virt-install virt-viewer --nogpgcheck
完成:
(11)启动libvirtd服务
bash
systemctl start libvirtd && systemctl enable libvirtd
4.OVN 中心端 连接数据库
(1)监听OVN北向数据库
bash
ovn-nbctl set-connection ptcp:6641:192.168.204.64
(2)监听OVN南向数据库
bash
ovn-sbctl set-connection ptcp:6642:192.168.204.64
(3)查看端口
bash
netstat -nltp | grep ovsdb-server
5.OVN 业务端1 加⼊控制器
(1)加入控制器南向接口
bash
ovs-vsctl set open . external-ids:ovn-remote=tcp:192.168.204.64:6642
(2)设置OVN系统ID
bash
ovs-vsctl set open . external-ids:system-id=node01
(3)设置OVN控制消息封装模式
bash
ovs-vsctl set open . external-ids:ovn-encap-type=geneve
(4)设置OVN本地连接地址
bash
ovs-vsctl set open . external-ids:ovn-encap-ip=192.168.204.65
(5)监听端口
bash
netstat -antp | grep 6642
(6)查看OVS
ovn_node01
bash
ovs-vsctl show
已⾃动建⽴分布式全互联管理综合⽹桥br-int
6.OVN 业务端2 加⼊控制器
(1)加入控制器南向接口
bash
ovs-vsctl set open . external-ids:ovn-remote=tcp:192.168.204.64:6642
(2)设置OVN系统ID
bash
ovs-vsctl set open . external-ids:system-id=node02
(3)设置OVN控制消息封装模式
bash
ovs-vsctl set open . external-ids:ovn-encap-type=geneve
(4)设置OVN本地连接地址
bash
ovs-vsctl set open . external-ids:ovn-encap-ip=192.168.204.66
(5)监听端口
bash
netstat -antp | grep 6642
(6)查看OVS
ovn_node02
bash
ovs-vsctl show
已⾃动建⽴分布式全互联管理综合⽹桥br-int
7.OVN 集群查看
(1) 中心端查看北向控制器
目前为空
bash
ovn-nbctl show
(2) 中心端查看南向控制器
已更新
bash
ovn-sbctl show
(3)中心端监听OVN南向数据库
bash
netstat -antp | grep 6642
(3)业务端查看隧道接⼝
bash
ip link | grep gene
ovn_node01
ovn_node02
(4)业务端查看Geneve协议
bash
ip -d link show genev_sys_6081
ovn_node01
ovn_node02
(5)业务端查看Geneve端口
ovn_node01
ovn_node02
二、问题
1.南向控制器节点名称报错
(1)报错
ovn_central
bash
Chassis "a01fe9cb-463f-4d2d-b3bb-810b6a923a01"
......
Chassis "37752d67-f6d8-47b7-9ce0-248eb2c1f1fc"
......
ovn_node01
bash
......
Port "ovn-37752d-0"
......
ovn_node02
bash
......
Port "ovn-a01fe9-0"
......
(2)原因分析
系统重启后,OVN系统ID丢失。
(3)解决方法
设置OVN系统ID,名字显示为Chassis:
ovn_node01
bash
ovs-vsctl set open . external-ids:system-id=node01
ovs-vsctl show
ovn_node02
bash
ovs-vsctl set open . external-ids:system-id=node02
ovs-vsctl show
ovn_central