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

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

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

问题

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

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

这是我的service.yaml文件:

apiVersion: v1
kind: Service
metadata:
  annotations:
    cloud.google.com/neg: '{"ingress":true}'
  labels:
    run: ubuntu
  name: ubuntu
  namespace: default
spec:
  loadBalancerIP: "<ipv6-address>"
  ipFamilies:
  - IPv6
  ipFamilyPolicy: SingleStack
  ports:
  - nodePort: 30783
    port: 5000
    protocol: TCP
    targetPort: 5001
  selector:
    run: ubuntu
  sessionAffinity: None
  type: LoadBalancer

这是我的gcloud地址列表:

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

我遇到了以下错误:

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

请帮助我进行调试。
英文:

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

This is my service.yaml

apiVersion: v1
kind: Service
metadata:
  annotations:
    cloud.google.com/neg: &#39;{&quot;ingress&quot;:true}&#39;
  labels:
    run: ubuntu
  name: ubuntu
  namespace: default
spec:
  loadBalancerIP: &quot;&lt;ipv6-address&gt;&quot;
  ipFamilies:
  - IPv6
  ipFamilyPolicy: SingleStack
  ports:
  - nodePort: 30783
    port: 5000
    protocol: TCP
    targetPort: 5001
  selector:
    run: ubuntu
  sessionAffinity: None
  type: LoadBalancer

This is my gcloud address list

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

I'm getting this error

  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,将创建负载均衡器。
apiVersion: v1
kind: Servicemetadata:
  name: my-lb-service
spec:
  type: LoadBalancer
  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.
apiVersion: v1
kind: Servicemetadata:
  name: my-lb-service
spec:
  type: LoadBalancer
  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:

确定