概述

OVN - Open Virtual Network,是一种SDN控制器,⽀持GRE, VXLAN, STT, Geneve四种overlay数据包

从层次上分为三层,分别是南向接口层,北向接口层,控制平面层。
北向接口层通过API处理其他控制平台例如K8S,OpenStack等平台请求
南向接口层通过openflow实现流表下发
控制平面层负责向北向接口的请求翻译为南向的请求进行下发

OVN结构概览

环境:

VMwareWorkstation17Pro

CentOS Linux release 7.9.2009 (Core)

——4G内存,20G硬盘,4core

建议采用template部署,写完yum源了再克隆

node01 ip:192.168.203.141

node02 ip:192.168.203.142

central ip:192.168.203.143

本次实验拓扑

OVN-Central节点安装

#官⽅安装⽂档 https://github.com/ovnorg/ovn/blob/main/Documentation/intro/install/general.rst

#删除原repo

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

#上传软件源repo,这些文件我放在资源了

CentOS-Base.repo

CentOS-NFS-Ganesha-28.repo

CentOS-QEMU-EV.repo

CentOS-Ceph-Nautilus.repo

CentOS-OpenStack-train.repo

CentOS-Storagecommon.repo

#系统升级 - 安装软件包 - 启动服务

yum clean all && yum makecache

yum upgrade -y --nogpgcheck

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

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

yum install -y ovn-central --nogpgcheck

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

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

#关闭防⽕墙

systemctl disable firewalld --now

#检查

ovs-vsctl show

ovn-nbctl show

ovn-sbctl show

systemctl is-active ovn-northd.service

systemctl is-active ovn-controller.service

#OVN-Central连接数据库

ovn-nbctl set-connection ptcp:6641:192.168.203.143 #6641端⼝⽤于监听OVN北向数据库

ovn-sbctl set-connection ptcp:6642:192.168.203.143 #6642端⼝⽤于监听OVN南向数据库

OVN-Node节点安装

#删除原repo

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

#上传软件源

repo CentOS-Base.repo CentOS-NFS-Ganesha-28.repo CentOS-QEMU-EV.repo

CentOS-Ceph-Nautilus.repo CentOS-OpenStack-train.repo CentOS-Storagecommon.repo

#系统升级 - 安装软件包 - 启动服务

yum clean all && yum makecache

yum upgrade -y --nogpgcheck

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

systemctl enable openvswitch.service --now

systemctl enable ovn-controller.service --now

#验证

systemctl is-active openvswitch.service

systemctl is-active ovn-controller.service

#关闭防⽕墙 

systemctl disable firewalld --now

systemctl status firewalld

#安装libvirt yum install -y qemu-kvm qemu-img virt-manager libvirt libvirt-python virtmanager libvirt-client virt-install virt-viewer --nogpgcheck

systemctl enable libvirtd --now

node节点连接控制器

#ovn-remote:指定南向数据库连接地址

#ovn-encap-ip:指定ovs/controller本地ip

#ovn-encap-type:指定隧道协议,这⾥⽤的是geneve

#system-id:节点标识ID

#node01

#添加链接控制器(链接到控制器南向接口)

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

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

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

#设置OVN控制消息封装模式 ,可以是VXLAN/GENEVE

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

#设置OVN本地连接地址,该地址⽤于⼤⼆层外层封装

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

#node2同理

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

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

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

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

#node2查看,⾃动建⽴⽹桥[br-int],隧道口网口,并从OVN自动下发z

参考资料

http://www.openvswitch.org//support/slides/OVN-Vancouver.pdf
https://benpfaff.org/~blp/ovn-lbnl.pdf
https://www.openvswitch.org/support/slides/OVN_Barcelona.pdf

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐