美文网首页云计算
metalLB svc 共享ip以及指定ip

metalLB svc 共享ip以及指定ip

作者: cloudFans | 来源:发表于2021-08-06 10:52 被阅读0次

    关于共享ip

    
    
    (py3env) [root@deployer metalLB]# cat test-external-lb-svc-share-ip-01.yml
    kind: Service
    apiVersion: v1
    metadata:
      name: srvclb-ngnx1
      annotations: 
        metallb.universe.tf/allow-shared-ip: "test-share-ip"  # 注意这里要采用同一个键
    spec:
      selector:
        app: hello1
        tier: frontend
      ports:
      - protocol: "TCP"
        port: 8080
        targetPort: 8080
      type: LoadBalancer
    ---
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: loadbalancer1
    spec:
      replicas: 2
      selector:
        matchLabels:
          app: hello1
      template:
        metadata:
          labels:
            app: hello1
            tier: frontend
        spec:
          containers:
          - name: nginx
            image: "nginxdemos/hello"
    
    
    
    
    (py3env) [root@deployer metalLB]# cat test-external-lb-svc-share-ip-02.yml
    kind: Service
    apiVersion: v1
    metadata:
      name: srvclb-ngnx2
      annotations: 
        metallb.universe.tf/allow-shared-ip: "test-share-ip"   # 注意这里要采用同一个键
    spec:
      selector:
        app: hello2
        tier: frontend
      ports:
      - protocol: "TCP"
        port: 8081
        targetPort: 8081
      type: LoadBalancer
    ---
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: loadbalancer2
    spec:
      replicas: 2
      selector:
        matchLabels:
          app: hello2
      template:
        metadata:
          labels:
            app: hello2
            tier: frontend
        spec:
          containers:
          - name: nginx
            image: "nginxdemos/hello"
    
    
    image.png

    参考:

    共享ip 官网参考: https://metallb.universe.tf/usage/#ip-address-sharing

    指定ip 参考模板: https://github.com/metallb/metallb/issues/271

    指定ip 可能没有 共享键更灵活,但是可以指定固定ip。

    扩展: metalLB需要支持的功能

    1.支持vpc 内部 aap(对应fip)

    2.支持多网卡响应arp,而非仅k8s node 管理的网卡

    相关文章

      网友评论

        本文标题:metalLB svc 共享ip以及指定ip

        本文链接:https://www.haomeiwen.com/subject/qwybvltx.html