我正在尝试使用loadBalancer类型服务向外界公开服务。
为此,我遵循了这个文档
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
Run Code Online (Sandbox Code Playgroud)
但是负载平衡器没有按预期创建我收到以下错误
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
Run Code Online (Sandbox Code Playgroud)
似乎是因为子网标签中的一些问题需要解决,但我的子网中有所需的标签
kubernetes.io/cluster/<cluster-name>. owned
kubernetes.io/role/elb 1
Run Code Online (Sandbox Code Playgroud)
但是,我仍然收到错误 could not find any suitable subnets for creating the ELB
我已经在 aws eks 中部署了节点应用程序,直到今天一切正常。当我今天部署最新版本时突然出现以下错误。
无法自动发现子网:UnauthorizedOperation:您无权执行此操作
{"level":"error","ts":1622476232.9828672,"logger":"controller","msg":"Reconciler error","controller":"ingress","name":"ingress-srv","namespace":"default","error":"couldn't auto-discover subnets: UnauthorizedOperation: You are not authorized to perform this operation.\n\tstatus code: 403, request id: 0a2968bf-62c2-4a29-a41a-e5defc135e3f"}
这是入口 yaml。
kind: Ingress
metadata:
name: ingress-srv
spec:
rules:
- http:
paths:
- backend:
serviceName: rabbitmq
servicePort: 15672
path: /api/v1/rabbitmq/*
pathType: Prefix
- backend:
serviceName: srv-auth
servicePort: 4000
path: /api/v1/users/*
pathType: Prefix
Run Code Online (Sandbox Code Playgroud)
这是部署yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: srv-auth-depl
spec:
replicas: 1
selector:
matchLabels:
app: srv-auth
template:
metadata:
labels:
app: srv-auth
spec:
containers:
- name: srv-auth …Run Code Online (Sandbox Code Playgroud)