kubernetes 设置IP地址时Istio无法创建负载平衡器

brvekthn  于 2023-03-01  发布在  Kubernetes
关注(0)|答案(2)|浏览(104)

我发现istio正在向Kubernetes Gateway API发展,所以我决定将Kubernetes Gateway API与Istio一起使用。
经过大量研究,我得出以下结论

---
apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
  name: istio-gateway
  namespace: istio-ingress
  annotations:
    # Cert Manager specific: only if you automatically issue certificate
    # when ready, switch to production-cluster-issuer
    cert-manager.io/cluster-issuer: staging-cluster-issuer
spec:
  addresses:
    - value: 34.98.116.35   <--- This is what causes LB not to be created
      type: IPAddress
  gatewayClassName: istio
  listeners:
    - name: staging-https
      protocol: HTTPS
      port: 443
      hostname: "staging.api.ipos.app"
      tls:
        mode: Terminate
        certificateRefs:
          - kind: Secret
            group:
            name: ipos-app-cert
      allowedRoutes:
        namespaces:
          from: All
    - name: qa-https
      protocol: HTTPS
      port: 443
      hostname: "qa.api.ipos.app"
      tls:
        mode: Terminate
        certificateRefs:
          - kind: Secret
            group:
            name: ipos-app-cert
      allowedRoutes:
        namespaces:
          from: All

每当删除地址时,都会创建一个Network (target pool-based) regional Load Balancer,并配置一个随机IP address
问题是我有一个保留的IP地址,我想将其用作自动调配的负载平衡器。尽管每当我添加以下代码时,负载平衡器从未调配过

addresses:
  - value: 34.98.116.35   <--- This is what causes LB not to be created
    type: IPAddress
wwtsj6pe

wwtsj6pe1#

如果要为自动预配的负载平衡器使用保留的IP地址,是否可以尝试将地址字段的类型字段设置为LoadBalancer,并在值字段中指定要使用的IP地址。例如:

address:
  - type: LoadBalancer
    value: 34.98.116.35

完成此操作后,应创建负载均衡器并使用指定的IP地址。

vdzxcuhz

vdzxcuhz2#

我们逐渐意识到问题不在Kubernetes Gateway清单文件中。我们所做的错误是保留了一个全局IP地址,并将该全局IP地址分配给网关。
网关需要一个与集群位于同一区域的区域IP地址。

addresses:
  - value: 34.98.116.35   <--- This must be Regional IP to work with Istio
    type: IPAddress

相关问题