无法将IPv6类型的负载均衡器IP添加到Kubernetes服务。

huangapple go评论90阅读模式
英文:

Not able to add ipv6 type Load Balancer IP in kubernetes service

问题

以下是您提供的内容的翻译:

我在使用GKE,并尝试使用IPv6地址公开一个应用程序。

这是我的service.yaml文件:

  1. apiVersion: v1
  2. kind: Service
  3. metadata:
  4. annotations:
  5. cloud.google.com/neg: '{"ingress":true}'
  6. labels:
  7. run: ubuntu
  8. name: ubuntu
  9. namespace: default
  10. spec:
  11. loadBalancerIP: "<ipv6-address>"
  12. ipFamilies:
  13. - IPv6
  14. ipFamilyPolicy: SingleStack
  15. ports:
  16. - nodePort: 30783
  17. port: 5000
  18. protocol: TCP
  19. targetPort: 5001
  20. selector:
  21. run: ubuntu
  22. sessionAffinity: None
  23. type: LoadBalancer

这是我的gcloud地址列表:

  1. deletable-pzk-reg-ip2-6 <ipv6-address>/96 EXTERNAL us-central1 pzksubnet1 RESERVED

我遇到了以下错误:

  1. Warning SyncLoadBalancerFailed 13s (x6 over 2m49s) service-controller Error syncing load balancer: failed to ensure load balancer: requested ip "<ipv6-address>" is neither static nor assigned to the LB
  2. 请帮助我进行调试。
英文:

I'm on GKE and I'm trying to expose one application using IPV6 address.

This is my service.yaml

  1. apiVersion: v1
  2. kind: Service
  3. metadata:
  4. annotations:
  5. cloud.google.com/neg: &#39;{&quot;ingress&quot;:true}&#39;
  6. labels:
  7. run: ubuntu
  8. name: ubuntu
  9. namespace: default
  10. spec:
  11. loadBalancerIP: &quot;&lt;ipv6-address&gt;&quot;
  12. ipFamilies:
  13. - IPv6
  14. ipFamilyPolicy: SingleStack
  15. ports:
  16. - nodePort: 30783
  17. port: 5000
  18. protocol: TCP
  19. targetPort: 5001
  20. selector:
  21. run: ubuntu
  22. sessionAffinity: None
  23. type: LoadBalancer

This is my gcloud address list

  1. deletable-pzk-reg-ip2-6 &lt;ipv6-address&gt;/96 EXTERNAL us-central1 pzksubnet1 RESERVED

I'm getting this error

  1. Warning SyncLoadBalancerFailed 13s (x6 over 2m49s) service-controller Error syncing load balancer: failed to ensure load balancer: requested ip &quot;&lt;ipv6-address&gt;&quot; is neither static nor assigned to the LB

Please help me in debugging this.

答案1

得分: 1

以下故障排除步骤可帮助您解决问题:

  1. IPv6仅适用于HTTP、SSL代理和TCP代理,请确保您正在使用其中之一。

  2. 以下文档描述了创建Ingress资源的过程。

  • 使用以下命令保留区域性外部IPv6地址。

    - gcloud compute addresses create &lt;your-ipv6-address-name&gt; --global --ip-version=IPv6

  • 在YAML文件中使用注释指定全局IP地址:

    kubernetes.io/ingress.global-static-ip-name: &lt;your-ipv6-address-name&gt;

  1. 如果要使用负载均衡器,请查看负载均衡器参数,例如:在保留静态IP之后,在yaml中将其用作loadBalancedIP,将创建负载均衡器。
  1. apiVersion: v1
  2. kind: Servicemetadata:
  3. name: my-lb-service
  4. spec:
  5. type: LoadBalancer
  6. loadBalancerIP: &lt;ip&gt;

附上一篇由John Hanley撰写的博客HTTP on Load Balancer and IPv6供您参考。

英文:

Below troubleshooting steps can help you to resolve your issue:

  1. IPv6 is only for HTTP, SSL Proxy and TCP proxy and make sure you are using one of them.

  2. The following documentation describes creation of an Ingress resource.

  • Using the following reserve a regional external IPv6 address.

    - gcloud compute addresses create &lt;your-ipv6-address-name&gt; --global --ip-version=IPv6

  • Specify the global ip address in the YAML file using the annotation:

    kubernetes.io/ingress.global-static-ip-name: &lt;your-ipv6-address-name&gt;

  1. If you want to use load balancer check the Load balancer parameters, example: After reserving the static IP use it as loadBalancedIP in yaml, the load balancer will be created.
  1. apiVersion: v1
  2. kind: Servicemetadata:
  3. name: my-lb-service
  4. spec:
  5. type: LoadBalancer
  6. loadBalancerIP: &lt;ip&gt;

Attaching a blog HTTP on Load Balancer and IPv6 authored by John Hanley for your reference.

huangapple
  • 本文由 发表于 2023年5月15日 13:51:55
  • 转载请务必保留本文链接:https://go.coder-hub.com/76251197.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定