简体   繁体   English

traefik 监听 80 端口并将请求转发到 minio console(5000) 404

[英]traefik listens on port 80 and forwards the request to minio console(5000) 404

I deployed minio and the console in K8S, used ClusterIP to expose ports 9000 & 5000我在K8S部署了minio和console,使用ClusterIP暴露了9000&5000端口

Listening for port 80 and 5000 forwarding requests to minio.service(ClusterIP)监听端口 80 和 5000 转发请求到 minio.service(ClusterIP)

Request console all right through port 5000通过端口 5000 请求控制台就可以了

By requesting the console on port 80, you can see the console, but the request is 404 in the browser通过在80端口请求console,可以看到console,但是在浏览器中请求是404

enter image description here在此处输入图像描述

enter image description here在此处输入图像描述


apiVersion: v1
kind: Service
metadata:
  namespace: {{ .Release.Namespace }}
  name: minio-headless
  labels:
    app: minio-headless
spec:
  type: ClusterIP
  clusterIP: None
  ports:
    - name: server
      port: 9000
      targetPort: 9000
    - name: console
      port: 5000
      targetPort: 5000
  selector:
    app: minio
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: ingress-route-minio
  namespace: {{ .Release.Namespace }}
spec:
  entryPoints:
    - minio
    - web
  routes:
    - kind: Rule
      match: Host(`minio-console.{{ .Release.Namespace }}.k8s.zszc`)
      priority: 10
      services:
        - kind: Service
          name: minio-headless
          namespace: {{ .Release.Namespace }}
          port: 5000
          responseForwarding:
            flushInterval: 1ms
          scheme: http
          strategy: RoundRobin
          weight: 10

traefik access log traefik 访问日志

{
  "ClientAddr": "192.168.4.250:55485",
  "ClientHost": "192.168.4.250",
  "ClientPort": "55485",
  "ClientUsername": "-",
  "DownstreamContentSize": 19,
  "DownstreamStatus": 404,
  "Duration": 688075,
  "OriginContentSize": 19,
  "OriginDuration": 169976,
  "OriginStatus": 404,
  "Overhead": 518099,
  "RequestAddr": "minio-console.etb-0-0-1.k8s.zszc",
  "RequestContentSize": 0,
  "RequestCount": 1018,
  "RequestHost": "minio-console.etb-0-0-1.k8s.zszc",
  "RequestMethod": "GET",
  "RequestPath": "/api/v1/login",
  "RequestPort": "-",
  "RequestProtocol": "HTTP/1.1",
  "RequestScheme": "http",
  "RetryAttempts": 0,
  "RouterName": "traefik-traefik-dashboard-6e26dcbaf28841493448@kubernetescrd",
  "StartLocal": "2023-01-27T13:20:06.337540015Z",
  "StartUTC": "2023-01-27T13:20:06.337540015Z",
  "entryPointName": "web",
  "level": "info",
  "msg": "",
  "time": "2023-01-27T13:20:06Z"
}

It looks to me like the request for /api is conflicting with rules for the Traefik dashboard.在我看来,对/api的请求与 Traefik 仪表板的规则冲突。 If you look at the access log in your question, we see:如果您查看问题中的访问日志,我们会看到:

  "RouterName": "traefik-traefik-dashboard-6e26dcbaf28841493448@kubernetescrd",

If you have installed Traefik from the Helm chart, it installs an IngressRoute with the following rules:如果您从 Helm chart 安装了IngressRoute ,它会安装一个具有以下规则的 IngressRoute:

  - kind: Rule
    match: PathPrefix(`/dashboard`) || PathPrefix(`/api`)
    services:
    - kind: TraefikService
      name: api@internal

In theory those are bound only to the traefik entrypoint, but it looks like you may have customized your entrypoint configuration.从理论上讲,它们只绑定到traefik入口点,但看起来您可能已经自定义了入口点配置。

Take a look at the IngressRoute resource for your Traefik dashboard and ensure that it's not sharing an entrypoint with minio.查看 Traefik 仪表板的 IngressRoute 资源,确保它没有与 minio 共享入口点。

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

相关问题 为基本 http 配置 traefik,以便仪表板使用端口 80 -- 找不到页面 404 - Configuring traefik for basic http so that dashboard uses port 80 -- get page 404 not found Traefik / Ngnix -(入口控制器)如何将请求转发到配置了相同端口号的两个不同服务。? - How does Traefik / Ngnix - (Ingress Controllers) forwards request to two different services having configured with same port number.? Traefik不想在80端口AWS上工作 - Traefik does not want to work on port 80 AWS Traefik 将一个应用程序路由到端口 80,其他需要显式端口 - Traefik routing one application to port 80, others require explicit port 在两个docker容器前配置Traefik,都在80端口 - Configure Traefik in front of two docker containers, all on port 80 Traefik和“让我们在非默认http端口80上加密”吗? - Traefik and Let's Encrypt on non default http port 80? 使用 helm3 在端口 80(hostNetwork)上安装 traefik 的权限问题 - Permission problem w/ helm3 installation of traefik on port 80 (hostNetwork) 如何在 K3s 上使用 Traefik 将端口 80 转发到服务端口 3000? - How do I forward port 80 to a service port 3000 using Traefik on K3s? 使用 traefik(v2) 路由器在特定端口上请求转发 - request forwarding on specific port with traefik(v2) router Traefik 错误背后的 Minio - 网关超时 - Minio behind Traefik error - Gateway Timeout
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM