gpt4 book ai didi

kubernetes - Ingress-nginx Controller 无法在AWS EC2 Kubernetes集群中正确运行ELB

转载 作者:行者123 更新时间:2023-12-02 11:46:43 34 4
gpt4 key购买 nike

我在AWS EC2上使用kops实用程序创建集群。现在,我正在尝试配置ingress-nginx Controller ,以便它路由群集中的所有流量。我需要它处理HTTP,HTTPS和WebSocket连接。基于此guide,我完成了所有必需的操作:

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/nginx-0.28.0/deploy/static/mandatory.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/nginx-0.28.0/deploy/static/provider/aws/service-l4.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/nginx-0.28.0/deploy/static/provider/aws/patch-configmap-l4.yaml

当我尝试使用 ingress-nginx获取 kubectl -n ingress-nginx get all命名空间中的所有项目时:
NAME                    TYPE           CLUSTER-IP    EXTERNAL-IP                                                                 PORT(S)                      AGE
service/ingress-nginx LoadBalancer 100.71.94.9 a7d3fe1383e344c1d8cb2de671xxxxxx-810xxxxxx.eu-central-1.elb.amazonaws.com 80:32389/TCP,443:31803/TCP 16m

当我打开AWS控制台-> EC2实例->负载均衡器时,我可以看到已经创建了ELB,但是在“实例”选项卡下的每个节点上都有 OutOfService状态。所以我无法访问我的ELB URL: a7d3fe1383e344c1d8cb2de671xxxxxx-810xxxxxx.eu-central-1.elb.amazonaws.com:

AWS Console - Load Balancers - ELB "Instances" tab

有关使用 kubectl -n ingress-nginx describe service/ingress-nginx的服务的更多详细信息
Name:                     ingress-nginx
Namespace: ingress-nginx
Labels: app.kubernetes.io/name=ingress-nginx
app.kubernetes.io/part-of=ingress-nginx
Annotations: kubectl.kubernetes.io/last-applied-configuration:
{"apiVersion":"v1","kind":"Service","metadata":{"annotations":{"service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout":"60"...
service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout: 60
service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: *
Selector: app.kubernetes.io/name=ingress-nginx,app.kubernetes.io/part-of=ingress-nginx
Type: LoadBalancer
IP: 100.71.94.9
LoadBalancer Ingress: a7d3fe1383e344c1d8cb2de671xxxxxx-810xxxxxx.eu-central-1.elb.amazonaws.com
Port: http 80/TCP
TargetPort: http/TCP
NodePort: http 32389/TCP
Endpoints: <none>
Port: https 443/TCP
TargetPort: https/TCP
NodePort: https 31803/TCP
Endpoints: <none>
Session Affinity: None
External Traffic Policy: Cluster
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal EnsuringLoadBalancer 15m service-controller Ensuring load balancer
Normal EnsuredLoadBalancer 15m service-controller Ensured load balancer

我错过了什么吗?

UPD#1

如果我在EKS集群中执行相同的操作,则一切正常,并且入口 Controller 出现在每个节点上。有任何想法吗..?

最佳答案

您需要在已部署nginx的EC2实例(kubernetes辅助节点)上添加安全组,以允许为ELB创建的安全组使用端口80和443。

编辑:
service/ingress-nginx服务的终结点部分没有nginx容器的IP。因此,当ELB发送运行状况检查请求但该请求无法到达Pod时,运行状况检查将失败,并且ELB将后端标记为服务中断。

关于kubernetes - Ingress-nginx Controller 无法在AWS EC2 Kubernetes集群中正确运行ELB,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60039675/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com