千云物流 - 使用k8s负载均衡openelb

openelb的介绍

具体根据官方文档进行安装官方文档,这里作为测试环境的安装使用.
OpenELB 是一个开源的云原生负载均衡器实现,可以在基于裸金属服务器、边缘以及虚拟化的 Kubernetes 环境中使用 LoadBalancer 类型的 Service 对外暴露服务。OpenELB 项目最初由 KubeSphere 社区 发起,目前已作为 CNCF 沙箱项目 加入 CNCF 基金会,由 OpenELB 开源社区维护与支持。
与MetalLB类似,OpenELB也拥有两种主要工作模式:Layer2模式和BGP模式。OpenELB的BGP模式目前暂不支持IPv6。

  • layer2 Mode
    在这里插入图片描述
    在这里插入图片描述

  • BGP Mode
    -在这里插入图片描述

准备k8s的环境

千云物流测试环境部署使用openelb部署.

所需要的软件&版本 对应依赖软件版本
linux [CentOS] 7.9.2009
kubernetes v1.22.12
docker [20.10.8] 20.10.8
openelb kubesphere/openelb:v0.5.1

准备Layer2 Mode配置

  • 配置ARP参数
    部署Layer2模式需要把k8s集群中的ipvs配置打开strictARP,

strict ARP configure arp_ignore and arp_announce to avoid answering ARP queries from kube-ipvs0 interface

# 查看kube-proxy中的strictARP配置
$ kubectl get configmap -n kube-system kube-proxy -o yaml | grep strictARP
#strictARP: false

# 手动修改strictARP配置为true
$ kubectl edit configmap -n kube-system kube-proxy
configmap/kube-proxy edited

# 使用命令直接修改并对比不同
$ kubectl get configmap kube-proxy -n kube-system -o yaml | sed -e "s/strictARP: false/strictARP: true/" | kubectl diff -f - -n kube-system

# 确认无误后使用命令直接修改并生效
$ kubectl get configmap kube-proxy -n kube-system -o yaml | sed -e "s/strictARP: false/strictARP: true/" | kubectl apply -f - -n kube-system

# 重启kube-proxy确保配置生效
$ kubectl rollout restart ds kube-proxy -n kube-system

# 确认配置生效
$ kubectl get configmap -n kube-system kube-proxy -o yaml | grep strictARP
      strictARP: true

开启之后k8s集群中的kube-proxy会停止响应kube-ipvs0网卡之外的其他网卡的arp请求,而由MetalLB接手处理。
strict ARP开启之后相当于把将arp_ignore设置为1;并将arp_announce设置为2启用严格的ARP,这个原理和LVS中的DR模式对RS的配置一样,可以参考之前的文章中的解释。

网卡配置

在这里插入图片描述

#多个网卡,需要指定master节点IP,一个网卡不需要
# kubectl annotate nodes k8s-master01 layer2.openelb.kubesphere.io/v1alpha1="masterip"

创建EIP

接下来我们需要配置loadbalancerIP所在的网段资源,这里我们创建一个Eip对象来进行定义,后面对IP段的管理也是在这里进行。

  • 部署eip
apiVersion: network.kubesphere.io/v1alpha2
kind: Eip
metadata:
  # Eip 对象的名称。
  name: layer2-eip
spec:
  # Eip 对象的地址池
  address: 10.0.0.122-10.0.0.123
  # openELB的运行模式,默认为bgp
  protocol: layer2
  # OpenELB 在其上侦听 ARP/NDP 请求的网卡。该字段仅在protocol设置为时有效layer2。
  interface: ens160
  # 指定是否禁用 Eip 对象
  # false表示可以继续分配
  # true表示不再继续分配
  disable: false
status:
  # 指定 Eip 对象中的IP地址是否已用完。
  occupied: false
  # 指定 Eip 对象中有多少个 IP 地址已分配给服务。
  # 直接留空,系统会自动生成
  usage:
  # Eip 对象中的 IP 地址总数。
  poolSize: 2
  # 指定使用的 IP 地址和使用 IP 地址的服务。服务以Namespace/Service name格式显示(例如,default/test-svc)。
  # 直接留空,系统会自动生成
  used:
  # Eip 对象中的第一个 IP 地址。
  firstIP: 10.0.0.122
  # Eip 对象中的最后一个 IP 地址。
  lastIP: 10.0.0.123
  ready: true
  # 指定IP协议栈是否为 IPv4。目前,OpenELB 仅支持 IPv4,其值只能是true.
  v4: true
  • 检查eip状态
 kubectl apply -f openelb/openelb-eip.yaml
 #部署完成后检查eip的状态
 kubectl get eip

部署openelb

这里我们还是使用yaml进行部署,官方把所有部署的资源整合到了一个文件中,我们还是老规矩先下载到本地再进行部署

apiVersion: v1
kind: Namespace
metadata:
  name: openelb-system
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.4.0
  creationTimestamp: null
  name: bgpconfs.network.kubesphere.io
spec:
  group: network.kubesphere.io
  names:
    kind: BgpConf
    listKind: BgpConfList
    plural: bgpconfs
    singular: bgpconf
  scope: Cluster
  versions:
    - name: v1alpha1
      schema:
        openAPIV3Schema:
          description: BgpConf is the Schema for the bgpconfs API
          properties:
            apiVersion:
              description: 'APIVersion defines the versioned schema of this representation
              of an object. Servers should convert recognized schemas to the latest
              internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
              type: string
            kind:
              description: 'Kind is a string value representing the REST resource this
              object represents. Servers may infer this from the endpoint the client
              submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
              type: string
            metadata:
              type: object
            spec:
              description: struct for container bgp:config. Configuration parameters
                relating to the global BGP router.
              properties:
                as:
                  description: original -> bgp:as bgp:as's original type is inet:as-number.
                    Local autonomous system number of the router.  Uses the 32-bit as-number
                    type from the model in RFC 6991.
                  format: int32
                  type: integer
                port:
                  description: original -> gobgp:port
                  format: int32
                  maximum: 65535
                  minimum: 1
                  type: integer
                routerID:
                  description: original -> bgp:router-id bgp:router-id's original type
                    is inet:ipv4-address. Router id of the router, expressed as an 32-bit
                    value, IPv4 address.
                  pattern: ^([0-9]{
   1,3}\.){
   3}[0-9]{
   1,3}$
                  type: string
              required:
                - as
                - port
                - routerID
              type: object
            status:
              description: BgpConfStatus defines the observed state of BgpConf
              type: object
          type: object
      served: true
      storage: false
    - name: v1alpha2
      schema:
        openAPIV3Schema:
          description: BgpConf is the Schema for the bgpconfs API
          properties:
            apiVersion:
              description: 'APIVersion defines the versioned schema of this representation
              of an object. Servers should convert recognized schemas to the latest
              internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
              type: string
            kind:
              description: 'Kind is a string value representing the REST resource this
              object represents. Servers may infer this from the endpoint the client
              submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
              type: string
            metadata:
              type: object
            spec:
              description: Configuration parameters relating to the global BGP router.
              properties:
                as:
                  format: int32
                  type: integer
                asPerRack:
                  additionalProperties:
                    format: int32
                    type: integer
                  type: object
                families:
                  items:
                    format: int32
                    type: integer
                  type: array
                gracefulRestart:
                  properties:
                    deferralTime:
                      format: int32
                      type: integer
                    enabled:
                      type: boolean
                    helperOnly:
                      type: boolean
                    localRestarting:
                      type: boolean
                    longlivedEnabled:
                      type: boolean
                    mode:
                      type: string
                    notificationEnabled:
                      type: boolean
                    peerRestartTime:
                      format: int32
                      type: integer
                    peerRestarting:
                      type: boolean
                    restartTime:
                      format: int32
                      type: integer
                    staleRoutesTime:
                      format: int32
                      type: integer
                  type: object
                listenAddresses:
                  items:
                    type: string
                  type: array
                listenPort:
                  format: int32
                  type: integer
                policy:
                  type: string
                routerId:
                  type: string
                useMultiplePaths:
                  type: boolean
              type: object
            status:
              description: BgpConfStatus defines the observed state of BgpConf
              properties:
                nodesConfStatus:
                  additionalProperties:
                    properties:
                      as:
                        format: int32
                        type: integer
                      routerId:
                        type: string
                    type: object
                  type: object
              type: object
          type: object
      served: true
      storage: true
      subresources:
        status: {
   }
status:
  acceptedNames:
    kind: ""
    plural: ""
  conditions: []
  storedVersions: []
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.4.0
  creationTimestamp: null
  name: bgppeers.network.kubesphere.io
spec:
  group: network.kubesphere.io
  names:
    kind: BgpPeer
    listKind: BgpPeerList
    plural: bgppeers
    singular: bgppeer
  scope: Cluster
  versions:
    - name: v1alpha1
      schema:
        openAPIV3Schema:
          description: BgpPeer is the Schema for the bgppeers API
          properties:
            apiVersion:
              description: 'APIVersion defines the versioned schema of this representation
              of an object. Servers should convert recognized schemas to the latest
              internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
              type: string
            kind:
              description: 'Kind is a string value representing the REST resource this
              object represents. Servers may infer this from the endpoint the client
              submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
              type: string
            metadata:
              type: object
            spec:
              properties:
                addPaths:
                  description: original -> bgp:add-paths Parameters relating to the
                    advertisement and receipt of multiple paths for a single NLRI (add-paths).
                  properties:
                    sendMax:
                      description: original -> bgp:send-max The maximum number of paths
                        to advertise to neighbors for a single NLRI.
                      type: integer
                  type: object
                config:
                  description: original -> bgp:neighbor-address original -> bgp:

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/179083.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

web需求记录

需求1:根据后端传过来的设备名:DESKTOP-4DQRGQB,以及mac:e0:be:03:74:40:0b;iQOO-8,mac:b0:33:66:38:c3:25,用web option 是动态增加的(也就是那个选择框里面的东西是根据后端传过来的值动态增加的&#xf…

[VS]控制台程序运行后无法聚焦到命令行窗口

0 环境 Windows11 22H2VS 2022 CommunityWindows Terminal 1.18.2822.0 1 问题说明 当使用 VS 写控制台程序时,运行后会弹出 CMD 窗口,并聚焦到该窗口。除了当前程序运行外,最后应该是暂停,等待用户输入任意按键,然…

竞赛 : 题目:基于深度学习的水果识别 设计 开题 技术

1 前言 Hi,大家好,这里是丹成学长,今天做一个 基于深度学习的水果识别demo 这是一个较为新颖的竞赛课题方向,学长非常推荐! 🧿 更多资料, 项目分享: https://gitee.com/dancheng-senior/pos…

论文笔记:Localizing Cell Towers fromCrowdsourced Measurements

2015 1 Intro 1.1 motivation opensignal.com 、cellmapper.net 和 opencellid.org 都是提供天线(antenna)位置的网站 他们提供的天线位置相当准确,但至少在大多数情况下不完全正确这个目标难以实现的原因是蜂窝网络供应商没有义务提供有…

3-合并区间

1题目描述 2思路 在合并区间之前,需要对所有的区间按照区间第一个元素进行排序,这样可以保证已经合并的各个区间之后不会再包含其他区间,或者被其他区间包含; 首先自己进行一下排序练习,回顾冒泡排序和选择排序&#…

Leetcode——121 买卖股票的最佳时机

(超时。。。。。。&#xff09;除了暴力法我是真的。。。。。。 class Solution {public int maxProfit(int[] prices) {int len prices.length;int max0;for(int i0;i<len-1;i){for(int ji1;j<len;j){int income prices[j] - prices[i];if(income>max){maxincome;…

真实网络中的 bbr

本文包含中心极限定理&#xff0c;大数定律&#xff0c;经济规律等&#xff0c;bbr 倒没多少&#xff0c;不过已经习惯把 bbr 当靶子了。 上周写了 揭秘 bbr 以及 抢带宽的原理&#xff0c;我对自己说&#xff0c;这都是理论上如何&#xff0c;可实际上呢。于是有必要结合更实际…

基于VM虚拟机下Ubuntu18.04系统,Hadoop的安装与详细配置

参考博客&#xff1a; https://blog.csdn.net/duchenlong/article/details/114597944 与上面这个博客几乎差不多&#xff0c;就是java环境配置以及后面的hadoop的hdfs-site.xml文件有一些不同的地方。 准备工作 1.更新 # 更新 sudo apt update sudo apt upgrade2.关闭防火…

数据结构-栈的实现

1.栈的概念及结构 栈&#xff1a;一种特殊的线性表&#xff0c;其只允许在固定的一端进行插入和删除元素操作。进行数据插入和删除操作的一端称为栈顶&#xff0c;另一端称为栈底。栈中的数据元素遵守后进先出LIFO&#xff08;Last In First Out&#xff09;的原则。 压栈&…

git-2

1.分离头指针情况下的注意事项 分离头指针指的是变更没有基于某个branch去做&#xff0c;所以当进行分支切换的时候&#xff0c;在分离头指针上产生的commit&#xff0c;很可能会被git当作垃圾清理掉&#xff0c;如果你认为是重要的内容&#xff0c;切记需要绑定分支 2.进一步…

NFC:应用场景广泛的短距离通信技术

NFC&#xff1a;应用场景广泛的短距离通信技术 一、NFC 技术介绍1.1 NFC 技术应用场景1.2 NFC 技术优点1.3 NFC 工作原理 二、NFC 开发2.1 NFC 应用开发流程2.2 NFC 读取和写入2.3 NFC 读写功能示例 三、总结 一、NFC 技术介绍 NFC &#xff08;Near-field communication&…

hadoop在本地创建文件,然后将文件拷贝/上传到HDFS

1.要$cd {对应目录}进入到对应目录&#xff0c;一般为 cd /usr/local/hadoop/ 2.创建文件&#xff0c;$sudo gedit {文件名}&#xff0c;例 sudo gedit test.txt 然后在弹出的txt文件输入内容&#xff0c;点击右上角的保存之后&#xff0c;关闭即可。 3.拷贝本地文件到HDF…

机器学习第12天:聚类

文章目录 机器学习专栏 无监督学习介绍 聚类 K-Means 使用方法 实例演示 代码解析 绘制决策边界 本章总结 机器学习专栏 机器学习_Nowl的博客-CSDN博客 无监督学习介绍 某位著名计算机科学家有句话&#xff1a;“如果智能是蛋糕&#xff0c;无监督学习将是蛋糕本体&a…

sql语法大全

1&#xff0c;创建数据库 create database 数据库名字; 2,查看所有的数据库名称 show databases; MySQL服务器已有4个数据库&#xff0c;这些数据库都是MySQL安装时自动创建的。 information_schema 和 performance_schema 数据库分别是 MySQL 服务器的数据字典&#xff08;…

everything排除目录

everything默认搜索所有文件&#xff0c;自己把没啥必要的目录都屏蔽掉&#xff0c;记录如下

分享一篇很就以前的文档-VMware Vsphere菜鸟篇

PS&#xff1a;由于内容是很久以前做的记录&#xff0c;在整理过程中发现了一些问题&#xff0c;简单修改后分享给大家。首先ESXI节点和win7均运行在VMware Workstation上面&#xff0c;属于是最底层&#xff0c;而新创建的CentOS则是嵌套后创建的操作系统&#xff0c;这点希望…

基于金枪鱼群算法优化概率神经网络PNN的分类预测 - 附代码

基于金枪鱼群算法优化概率神经网络PNN的分类预测 - 附代码 文章目录 基于金枪鱼群算法优化概率神经网络PNN的分类预测 - 附代码1.PNN网络概述2.变压器故障诊街系统相关背景2.1 模型建立 3.基于金枪鱼群优化的PNN网络5.测试结果6.参考文献7.Matlab代码 摘要&#xff1a;针对PNN神…

transformer之KV Cache

一、为什么要研究KV Cache 非常有效的加速推理速度&#xff0c;效果如下所示&#xff1a; import numpy as np import time import torch from transformers import AutoModelForCausalLM, AutoTokenizer NAME_OR_PATH r*************** device "cuda" if torch.cu…

SpringBoot——启动类的原理

优质博文&#xff1a;IT-BLOG-CN SpringBoot启动类上使用SpringBootApplication注解&#xff0c;该注解是一个组合注解&#xff0c;包含多个其它注解。和类定义SpringApplication.run要揭开SpringBoot的神秘面纱&#xff0c;我们要从这两位开始就可以了。 SpringBootApplicati…

用友NC Cloud uploadChunk任意文件上传漏洞复现 [附POC]

文章目录 用友NC Cloud uploadChunk任意文件上传漏洞复现 [附POC]0x01 前言0x02 漏洞描述0x03 影响版本0x04 漏洞环境0x05 漏洞复现1.访问漏洞环境2.构造POC3.复现 0x06 修复建议 用友NC Cloud uploadChunk任意文件上传漏洞复现 [附POC] 0x01 前言 免责声明&#xff1a;请勿利…