简体   繁体   中英

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

Listening for port 80 and 5000 forwarding requests to minio.service(ClusterIP)

Request console all right through port 5000

By requesting the console on port 80, you can see the console, but the request is 404 in the browser

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

{
  "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. 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:

  - 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.

Take a look at the IngressRoute resource for your Traefik dashboard and ensure that it's not sharing an entrypoint with minio.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM