【问题标题】:To make a LoadBalancer service internal on GKE在 GKE 上创建 LoadBalancer 服务内部
【发布时间】:2022-01-13 16:36:10
【问题描述】:

你知道我们可以在 GKE 上使用它来使 LoadBalancer 服务内部化的注解是什么吗?例如 Azure(和 AWS)支持以下注释(显示在 YAML 代码 sn-p 中)以使 LoadBalancer 服务成为内部服务。我在 GKE 上找不到它的等价物。例如,自然而然地,人们可能会期望 gcp-load-balancer-internal 作为 GKE 上的等效注解;不幸的是,事实并非如此。这是它的 Azure 和 AWS 文档,我在 GKE 上寻找它的等价物。

apiVersion: v1
kind: Service
metadata:
  annotations:
    service.beta.kubernetes.io/aws-load-balancer-internal: "true"
    service.beta.kubernetes.io/azure-load-balancer-internal: "true"

【问题讨论】:

    标签: kubernetes google-kubernetes-engine


    【解决方案1】:

    可以在here找到等价物。

    apiVersion: v1
    kind: Service
    metadata:
      name: ilb-service
      annotations:
        networking.gke.io/load-balancer-type: "Internal"
      labels:
        app: hello
    spec:
      type: LoadBalancer
      selector:
        app: hello
      ports:
      - port: 80
        targetPort: 8080
        protocol: TCP
    

    【讨论】:

      【解决方案2】:

      有2个注解:

      对于 GKE 1.17 及更高版本,请使用注释:

      networking.gke.io/load-balancer-type: "Internal"
      

      对于早期版本,请使用注解:

      cloud.google.com/load-balancer-type: "Internal"
      

      另外,我将在以下网址 Using an internal TCP/UDP load balancerSetting up Internal HTTP(S) Load Balancing 中与您分享一些 GCP 有用的官方文档。

      【讨论】:

        猜你喜欢
        • 2019-04-24
        • 2020-09-18
        • 2023-02-10
        • 2019-10-18
        • 2019-04-27
        • 2020-04-23
        • 1970-01-01
        • 2019-06-26
        • 2022-01-13
        相关资源
        最近更新 更多