无法将静态IP给nlb [英] unable to give static ip to nlb

查看:95
本文介绍了无法将静态IP给nlb的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很难使用入口控制器使它与NLB一起使用: https://kubernetes.github.io/ingress-nginx /deploy/#network-load-balancer-nlb

I have hard time getting this working with NLB using ingress controller : https://kubernetes.github.io/ingress-nginx/deploy/#network-load-balancer-nlb

即使子网在这里也没有生效,也没有在创建NLB的API中传递我的配置:

Even subnets are not taking effect here , its not passing my configurations in the API that creates the NLB:

================================
kind: Service
apiVersion: v1
metadata:
  name: ingress-nginx
  namespace: ingress-nginx
  labels:
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/part-of: ingress-nginx
  annotations:
    service.beta.kubernetes.io/aws-load-balancer-type: nlb
    service.beta.kubernetes.io/aws-load-balancer-eip-allocations: "eipalloc- 
    07e3afcd4b7b5d644,eipalloc-0d9cb0154be5ab55d,eipalloc-0e4e5ec3df81aa3ea"
    service.beta.kubernetes.io/aws-load-balancer-subnets: "subnet- 
    061f4a497621a7179,subnet-001c2e5df9cc93960"
spec:
  type: LoadBalancer
  selector:
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/part-of: ingress-nginx
  ports:
  - name: http
    port: 80
    targetPort: http
  - name: https
    port: 443
    targetPort: https

推荐答案

因此,事实证明,仅自Kubernetes 1.16(在AWS上即将推出)以来,才支持这些注释. 当前支持的版本是1.15,它只是忽略那些注释...

So, as it turned out - these annotations will be supported only since Kubernetes 1.16, which is "coming soon" on AWS. Currently supported version is 1.15, which just ignores those annotations...

考虑到您在此处使用特定于AWS的注释(service.beta.kubernetes.io/aws-load-balancer-eip-allocations)-我认为这正是它不适用于您的案例的原因.

Considering that you are using AWS-specific annotations here (service.beta.kubernetes.io/aws-load-balancer-eip-allocations) - I assume that this is exactly the reason why it does not work on your case.

作为解决方法,我建议:

As a workaround, I would advice:

  1. 在每次Kubernetes服务更新之后,创建自定义的部署后脚本,以重新配置新创建的LoadBalancer.
  2. 切换为使用更常规的方式,例如将ELB与您的Container和AutoScaling组配合使用(这就是我们所做的.)
  3. 设置您自己的Kubernetes Controller(超级硬的东西,一旦1.16正式发布,它将变得完全过时,并且基本上只是浪费时间).请参阅此方法
  4. 等等...
  1. Create custom post-deployment script that re-configures newly-created LoadBalancer, after each Kubernetes Service Update.
  2. Switch to use something more conventional, like ELB with your Container, and AutoScaling groups (that's what we did.)
  3. Setup your own Kubernetes Controller (super-hard thingie, which will become completely obsolete and will just be basically a lost of time, as soon as 1.16 is officially out). See this how-to
  4. Wait...

官方声明: https://docs.aws. amazon.com/eks/latest/userguide/update-cluster.html#1-16-prequisites

注释的完整列表(将在ofc中被支持"):

Full list of annotations (when they will be "supported" ofc): https://github.com/kubernetes/kubernetes/blob/v1.16.0/staging/src/k8s.io/legacy-cloud-providers/aws/aws.go#L208-L211

敬请期待! :(

这篇关于无法将静态IP给nlb的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆