openshift 4 kvm+ovs install

Posted wandering-star

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了openshift 4 kvm+ovs install相关的知识,希望对你有一定的参考价值。

https://github.com/wangzheng422/docker_env/blob/master/redhat/ocp4/4.4/4.4.ovs.md

openshift 4 kvm+ovs install

openshift4在日常的安装场景中,有这样一个情况,就是需要在多台配置小一些的主机上,实现跨主机的集群安装,这就需要多个kvm跨主机通讯,本来使用bridge方式,搭配可直连的ip地址,是可以满足的,但是由于ip地址管理的限制,我们没有可以直连的ip地址,那么我们就需要ovs+vxlan的方式,来解决这个问题。

本文模拟2台主机,讲述如何配置ovs,以及如何启动kvm。

参考资料:

mtu 调整:

vxlan

on redhat-01


yum -y install openvswitch2.11 NetworkManager-ovs
# install pkg for vnc and kvm

systemctl enable --now openvswitch
systemctl status openvswitch

systemctl enable --now libvirtd

cat << ‘EOF‘ > /etc/sysconfig/network-scripts/ifcfg-br-int 
DEVICE=br-int
ONBOOT=yes
DEVICETYPE=ovs
TYPE=OVSBridge
BOOTPROTO=static
HOTPLUG=no
IPADDR=192.168.7.1
PREFIX=24
MTU=1450
EOF

cat << ‘EOF‘ > /etc/sysconfig/network-scripts/ifcfg-vxlan1
DEVICE=vxlan1
ONBOOT=yes
DEVICETYPE=ovs
TYPE=OVSTunnel
OVS_BRIDGE=br-int
OVS_TUNNEL_TYPE=vxlan
OVS_TUNNEL_OPTIONS="options:remote_ip=172.29.159.100"
BOOTPROTO=static
HOTPLUG=no
EOF

systemctl restart network

ovs-vsctl show

ovs-vsctl set int br-int mtu_request=1450
# ovs-vsctl set int br-int mtu_request=[]

mkdir -p /data/kvm
cd /data/kvm

cat << ‘EOF‘ > ovsnet.xml
<network>
  <name>br-int</name>
  <forward mode=‘bridge‘/>
  <bridge name=‘br-int‘/>
  <virtualport type=‘openvswitch‘/>
</network>
EOF

virsh net-define ovsnet.xml
virsh net-start br-int
virsh net-autostart br-int

on redhat-02

 
yum -y install openvswitch2.11 NetworkManager-ovs
# install pkg for vnc and kvm

systemctl enable --now openvswitch
systemctl status openvswitch

systemctl enable --now libvirtd

ovs-vsctl show

cat << ‘EOF‘ > /etc/sysconfig/network-scripts/ifcfg-br-int 
DEVICE=br-int
ONBOOT=yes
DEVICETYPE=ovs
TYPE=OVSBridge
BOOTPROTO=static
HOTPLUG=no
IPADDR=192.168.7.2
PREFIX=24
MTU=1450
EOF

cat << ‘EOF‘ > /etc/sysconfig/network-scripts/ifcfg-vxlan1
DEVICE=vxlan1
ONBOOT=yes
DEVICETYPE=ovs
TYPE=OVSTunnel
OVS_BRIDGE=br-int
OVS_TUNNEL_TYPE=vxlan
OVS_TUNNEL_OPTIONS="options:remote_ip=172.29.159.99"
BOOTPROTO=static
HOTPLUG=no
EOF

systemctl restart network

ovs-vsctl show

ovs-vsctl set int br-int mtu_request=1450

mkdir -p /data/kvm
cd /data/kvm

cat << ‘EOF‘ > ovsnet.xml
<network>
  <name>br-int</name>
  <forward mode=‘bridge‘/>
  <bridge name=‘br-int‘/>
  <virtualport type=‘openvswitch‘/>
</network>
EOF

virsh net-define ovsnet.xml
virsh net-start br-int
virsh net-autostart br-int

# restore
virsh net-undefine br-int
virsh net-destroy br-int


创建虚拟机


mkdir -p /data/kvm
cd /data/kvm

lvremove -f datavg/helperlv
lvcreate -y -L 230G -n helperlv datavg

# 230G
virt-install --name="ocp4-aHelper" --vcpus=2 --ram=4096 --disk path=/dev/datavg/helperlv,device=disk,bus=virtio,format=raw --os-variant centos7.0 --network network:br-int,model=virtio --boot menu=on --location /data/kvm/rhel-server-7.8-x86_64-dvd.iso --initrd-inject /data/kvm/helper-ks.cfg --extra-args "inst.ks=file:/helper-ks.cfg" 

以上是关于openshift 4 kvm+ovs install的主要内容,如果未能解决你的问题,请参考以下文章

How To Deploy OpenShift Container Platform 4.8 on KVM

How To Deploy OpenShift Container Platform 4.8 on KVM

Openshift开启Calico BGP 与 OVS性能PK

OVS+Linux Vxlan组网

生成MAC地址

OVS