4

我正在创建一个 kubernetes 集群来托管服务,并添加了一个内部负载均衡器来路由我的 VM 实例和 kubernetes 集群之间的流量。我想向负载均衡器 FrontEnd 添加一个服务标签,以便我可以使用 dns 名称而不是 IP 地址。但我不知道用于添加服务标签的注释?我的 terraform 配置如下所示

知道在哪里可以找到支持的注释列表

resource "kubernetes_manifest" "service_ilb" {
  provider = kubernetes-alpha

  manifest = {
    "apiVersion" = "v1"
    "kind"       = "Service"

    "metadata" = {
      "name"      = "ilb-service"
      "namespace" = var.namespace

      "annotations" = {
        "cloud.google.com/load-balancer-type"                          = "Internal"
        "networking.gke.io/internal-load-balancer-allow-global-access" = "true"
        "networking.gke.io/internal-load-balancer-subnet"              = var.subnetwork
        # Does not work
        "networking.gke.io/internal-load-balancer-service-label"       = "my-dns-name" 
      }
      "labels" = {
        "app.kubernetes.io/component" = "rabbitmq-server"
        "app.kubernetes.io/name"      = "rabbitmq-instance"
      }
    }

    "spec" = {
      "type" = "LoadBalancer"

      "ports" = [
        {
          "name"       = "amqp-tls"
          "port"       = 5671
          "targetPort" = 5671
          "protocol"   = "TCP"
          "nodePort"   = 31212
        },
        {
          "name"       = "http"
          "port"       = 15672
          "targetPort" = 15672
          "protocol"   = "TCP"
          "nodePort"   = 32511
        },
      ]

      "selector" = {
        "app.kubernetes.io/component" = "rabbitmq-server"
        "app.kubernetes.io/name"      = "rabbitmq-instance"
      }
    }
  }
  /*
  wait_for = {
    fields = {
      # Check an ingress has an IP
      "status.loadBalancer.ingress.0.ip" = "^(\\d+(\\.|$)){4}"
    }
  }
  */
}

提前致谢

4

0 回答 0