本文介绍了EKS:找不到任何合适的子网来创建 ELB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 loadBalancer 类型的服务向外界公开服务.

I am trying to expose a service to the outside world using the loadBalancer type service.

为此,我遵循了这个文档

For that, i have followed this doc

https://aws.amazon.com/premiumsupport/knowledge-center/eks-kubernetes-services-cluster/

我的 loadbalancer.yaml 看起来像这样

My loadbalancer.yaml looks like this

apiVersion: v1
kind: Service
metadata:
  name: nginx-service
spec:
  type: LoadBalancer
  selector:
    app: nginx
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80

但是负载均衡器没有按预期创建我收到以下错误

But the load balancer is not creating as expected I am getting the following error

Warning  SyncLoadBalancerFailed  8s (x3 over 23s)  service-controller  Error syncing load balancer: failed to ensure load balancer: could not find any suitable subnets for creating the ELB

似乎是因为子网标签中的一些问题需要解决,但我的子网中有所需的标签

Seems like its because of some issues in the subnet tags to solve,but i have the required tags in my subnets

kubernetes.io/cluster/<cluster-name>. owned
kubernetes.io/role/elb   1

但是,我仍然收到错误 找不到任何合适的子网来创建 ELB

But still, I am getting the error could not find any suitable subnets for creating the ELB

推荐答案

默认情况下,AWS EKS 仅将负载均衡器附加到公共子网.为了在私有子网中启动它,您不仅需要标记您的子网(看起来就像您所做的那样),还需要注释您的负载均衡器-

By default AWS EKS only attaches load balancers to public subnets. In order to launch it in a private subnet you need to not only label your subnets (which it looks like you did) but also annotate your load balancer-

service.beta.kubernetes.io/aws-load-balancer-internal:真"

您可以在此处找到更多信息.

You can find more information here.

这篇关于EKS:找不到任何合适的子网来创建 ELB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-01 12:09