自学内容网 自学内容网

multus使用教程

操作步骤如下:
1.在vmware vsphere上配置所有主机使用的端口组安全项
Forged transmits 设置为: Accept Promiscuous Mode 设置为:Accept Promiscuous Mode(混杂模式)和Forged Transmits(伪传输)
2.给每台主机添加第二块网卡
3.创建网络定义

DHCP类型

apiVersion: k8s.cni.cncf.io/v1
kind: NetworkAttachmentDefinition
metadata:
  name: net10
  namespace: default
spec:
  config: |-
    {
      "cniVersion": "0.3.1",
      "name": "net10",
      "type": "macvlan",
      "master": "ens224","mode": "bridge",
      "ipam": {
        "type": "whereabouts",
        "range": "10.10.10.0/24","range_start": "10.10.10.100","range_end": "10.10.10.200","routes": [
          { "dst": "10.10.0.0/16","gw": "10.10.10.1"}]
      }
    }

① 第二块网卡名称
② 第二块网卡所在网络CIDR
③ ④IP地址池范围
④ 自定义路由

静态IP类型

apiVersion: k8s.cni.cncf.io/v1
kind: NetworkAttachmentDefinition
metadata:
  name: net10-static
  namespace: default
spec:
  config: |-
    {
      "cniVersion": "0.3.1",
      "name": "net10-static",
      "type": "macvlan",
      "master": "ens224",
      "mode": "bridge",
      "ipam": {
        "type": "static",
        "routes": [
          { "dst": "10.10.0.0/16", "gw": "10.10.10.1" }
        ]
      }
    }

pod使用多网络 ,给POD指定注解:

#DHCP方式:
metadata:
  annotations:
    k8s.v1.cni.cncf.io/networks: default/net10

#静态IP方式:
metadata:
  annotations:
    k8s.v1.cni.cncf.io/networks: '[{"name":  "net10-static", "namespace":"default"  ,"ips": ["10.10.10.188/24" ]}]'

给StatefulSet/Deployement指定注解:

#DHCP方式:
spec:
  template:
    metadata:
      annotations:
        k8s.v1.cni.cncf.io/networks: default/net10

#静态IP方式:replicas只能为1
spec:
  template:
    metadata:
      annotations:
        k8s.v1.cni.cncf.io/networks: '[{"name": "net10-static", "namespace":"default" ,"ips": ["10.10.10.102/24" ]}]'

原文地址:https://blog.csdn.net/qq_32789063/article/details/145286612

免责声明:本站文章内容转载自网络资源,如侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!