簡體   English   中英

traefik 監聽 80 端口並將請求轉發到 minio console(5000) 404

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

我在K8S部署了minio和console,使用ClusterIP暴露了9000&5000端口

監聽端口 80 和 5000 轉發請求到 minio.service(ClusterIP)

通過端口 5000 請求控制台就可以了

通過在80端口請求console,可以看到console,但是在瀏覽器中請求是404

在此處輸入圖像描述

在此處輸入圖像描述


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 訪問日志

{
  "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"
}

在我看來,對/api的請求與 Traefik 儀表板的規則沖突。 如果您查看問題中的訪問日志,我們會看到:

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

如果您從 Helm chart 安裝了IngressRoute ,它會安裝一個具有以下規則的 IngressRoute:

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

從理論上講,它們只綁定到traefik入口點,但看起來您可能已經自定義了入口點配置。

查看 Traefik 儀表板的 IngressRoute 資源,確保它沒有與 minio 共享入口點。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM