EKS:找不到用于创建ELB的任何合适的子网 [英] EKS : could not find any suitable subnets for creating the 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
看起来像这样
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
但是,仍然出现错误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:"true"
service.beta.kubernetes.io/aws-load-balancer-internal: "true"
您可以在此处找到更多信息.
You can find more information here.
这篇关于EKS:找不到用于创建ELB的任何合适的子网的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!