Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/kubernetes/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ingress nginx控制器在AWS EC2 Kubernetes群集中未正确运行ELB_Kubernetes_Kubernetes Ingress_Nginx Ingress_Kops - Fatal编程技术网

Ingress nginx控制器在AWS EC2 Kubernetes群集中未正确运行ELB

Ingress nginx控制器在AWS EC2 Kubernetes群集中未正确运行ELB,kubernetes,kubernetes-ingress,nginx-ingress,kops,Kubernetes,Kubernetes Ingress,Nginx Ingress,Kops,我使用AWS EC2上的kops实用程序创建集群。现在我正在尝试配置控制器,以便它路由集群中的所有流量。我需要它处理HTTP、HTTPS和WebSocket连接。基于此,我制作了所有必需的东西: kubectl应用-fhttps://raw.githubusercontent.com/kubernetes/ingress-nginx/nginx-0.28.0/deploy/static/mandatory.yaml kubectl应用-fhttps://raw.githubusercontent

我使用AWS EC2上的
kops
实用程序创建集群。现在我正在尝试配置控制器,以便它路由集群中的所有流量。我需要它处理HTTP、HTTPS和WebSocket连接。基于此,我制作了所有必需的东西:

kubectl应用-fhttps://raw.githubusercontent.com/kubernetes/ingress-nginx/nginx-0.28.0/deploy/static/mandatory.yaml
kubectl应用-fhttps://raw.githubusercontent.com/kubernetes/ingress-nginx/nginx-0.28.0/deploy/static/provider/aws/service-l4.yaml
kubectl应用-fhttps://raw.githubusercontent.com/kubernetes/ingress-nginx/nginx-0.28.0/deploy/static/provider/aws/patch-configmap-l4.yaml
当我尝试使用
kubectl-n ingres nginx get all获取
ingres nginx
命名空间中的所有项时:

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

关于使用
kubectl-n入口nginx描述服务/ingres 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
名称:ingress nginx
名称空间:ingress nginx
标签:app.kubernetes.io/name=ingress nginx
app.kubernetes.io/部分=入口nginx
注释:kubectl.kubernetes.io/last-applicated-configuration:
{“apiVersion”:“v1”,“种类”:“服务”,“元数据”:{“注释”:{“Service.beta.kubernetes.io/aws负载平衡器连接空闲超时”:“60”。。。
service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout:60
service.beta.kubernetes.io/aws-load-balancer-proxy-protocol:*
选择器:app.kubernetes.io/name=ingress nginx,app.kubernetes.io/part of=ingress nginx
类型:负载平衡器
IP:100.71.94.9
负载平衡器入口:a7d3fe1383e344c1d8cb2de671xxxxxx-810xxxxxx.eu-central-1.elb.amazonaws.com
端口:http 80/TCP
目标端口:http/TCP
节点端口:http 32389/TCP
端点:
端口:https 443/TCP
目标端口:https/TCP
节点端口:https 31803/TCP
端点:
会话关联:无
外部流量策略:群集
活动:
从消息中键入原因年龄
----    ------                ----  ----                -------
正常确保负载平衡器15m服务控制器确保负载平衡器
正常保证负载平衡器15m服务控制器保证负载平衡器
我错过什么了吗

UPD#1


如果我在EKS集群中执行相同的操作,那么一切都会正常工作,每个节点上都会显示ingress controller。有什么想法吗?

您需要在EC2实例(kubernetes worker nodes)上添加安全组,在EC2实例中部署nginx,以允许为ELB创建的安全组使用端口80和443

编辑:


服务/ingress nginx
服务的endpoints部分没有nginx POD的IP。因此,当ELB发送健康检查请求但请求无法到达POD时,健康检查失败,ELB将后端标记为outofservice。

我有这种安全组。默认情况下,它具有所有必需的设置。您认为呢在负载平衡器的安全组上是否还有出站规则?是。所有流量:All:All:0.0.0/0。只需确认“All:All:0.0.0.0/0”是否在入站或出站?出站中。此安全组在运行
kubectl apply-f…/service-l4.yaml时自动创建。