简体   繁体   English

Kubernetes 入口未将流量路由到后端端口

[英]Kubernetes Ingress not routing traffic to backend port

Ingress is not routing traffic to backend service port. Ingress 没有将流量路由到后端服务端口。 Connection times out.连接超时。

Any idea how to troubleshoot?知道如何排除故障吗? There are no errors in the ingress controller logs.入口 controller 日志中没有错误。

curl -v -L https://www.example.com
*   Trying 172.20.xxx.xx:443...

I've checked the Loadbalancer and its health is fine.我检查了负载均衡器,它的运行状况很好。 I'm not sure why its not routing traffic to backend port and what else I could check to figure out what the issue is.我不确定为什么它不将流量路由到后端端口,以及我还可以检查什么来找出问题所在。

Here is my aws ingress controller.yaml config:这是我的 aws ingress controller.yaml配置:

apiVersion: v1
kind: Service
metadata:
  annotations:
    service.beta.kubernetes.io/aws-load-balancer-backend-protocol: tcp
    service.beta.kubernetes.io/aws-load-balancer-cross-zone-load-balancing-enabled: "true"
    service.beta.kubernetes.io/aws-load-balancer-internal: "true"
    service.beta.kubernetes.io/aws-load-balancer-type: nlb
    service.beta.kubernetes.io/aws-load-balancer-ssl-cert: "arn:aws:acm:xxx"
    service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "443"
  labels:
    app.kubernetes.io/component: controller
    app.kubernetes.io/instance: ingress-nginx
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/part-of: ingress-nginx
    app.kubernetes.io/version: 1.3.0
  name: ingress-nginx-controller
  namespace: ingress-nginx
spec:
  externalTrafficPolicy: Cluster
  ipFamilies:
  - IPv4
  ipFamilyPolicy: SingleStack
  ports:
  - appProtocol: http
    name: http
    port: 80
    protocol: TCP
    targetPort: http
  - appProtocol: https
    name: https
    port: 443
    protocol: TCP
    targetPort: http
  selector:
    app.kubernetes.io/component: controller
    app.kubernetes.io/instance: ingress-nginx
    app.kubernetes.io/name: ingress-nginx
  type: LoadBalancer

And here the service config service.yaml :这里是服务配置service.yaml

apiVersion: v1
kind: Service
metadata:
  creationTimestamp: "2022-08-06T12:16:17Z"
  labels:
    app: manageiq
  name: httpd
  namespace: default
spec:
  clusterIP: 100.69.xxx.xx
  clusterIPs:
  - 100.69.xxx.xx
  internalTrafficPolicy: Cluster
  ipFamilies:
  - IPv4
  ipFamilyPolicy: SingleStack
  ports:
  - name: http
    port: 8080
    protocol: TCP
    targetPort: 8080
  selector:
    name: httpd
  sessionAffinity: None
  type: ClusterIP
status:
  loadBalancer: {}

Ingress.yaml : Ingress.yaml

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: nginx
  creationTimestamp: "2022-08-06T12:47:32Z"
  generation: 2
  labels:
    app: manageiq
  name: httpd
  namespace: default
spec:
  rules:
  - host: www.example.com
    http:
      paths:
      - backend:
          service:
            name: httpd
            port:
              number: 8080
        path: /
        pathType: ImplementationSpecific
status:
  loadBalancer:
    ingress:
    - hostname: adc1d30f0db264d7ea54aed4dcdc12ec-atest.elb.ap-south-1.amazonaws.com

Figured it out.弄清楚了。 Loadbalancer was set to internal.负载均衡器设置为内部。 I was following a documentation.我正在关注文档。

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

I had to delete services and recreate so a new load balancer gets created.我不得不删除服务并重新创建,以便创建一个新的负载均衡器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Kube.netes - Ingress-nginx 路由错误(无法将前端连接到后端) - Kubernetes - Ingress-nginx routing error (Cannot connect frontend to backend) 将 EKS(AWS kubernetes)上 JHub 的入口流量列入白名单的好方法? - Good way to whitelist ingress traffic for JHub on EKS (AWS kubernetes)? Kubernetes nginx HTTPS 在 AWS 中的基于入口路径的路由 - Kubernetes nginx ingress path-based routing of HTTPS in AWS Kube.netes NetworkPolicy 并且只允许来自相同命名空间和 ALB Ingress 的流量 - Kubernetes NetworkPolicy and only allow traffic from same Namespace and from ALB Ingress kubernetes 入口控制器`400 错误请求 - 普通 HTTP 请求发送到 HTTPS 端口` - kubernetes ingress-controller `400 Bad request - plain HTTP request sent to HTTPS port` AWS中的Kubernetes入口 - Kubernetes ingress in AWS Kubernetes SSL 重定向入口 - Kubernetes SSL Redirect Ingress AWS - ELB - 将 http/https 流量路由到 EC2 实例的自定义端口 - AWS - ELB - Routing http/https traffic to a custom port of EC2 instance EKS Kubernetes 出站流量 - EKS Kubernetes outbound traffic Ingress资源与Kubernetes上的NGINX入口控制器 - Ingress resource vs NGINX ingress controller on Kubernetes
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM