简体   繁体   English

ERR_TOO_MANY_REDIRECTS 302 与 ELK Operator 7.10.0 使用 Server.basePath

[英]ERR_TOO_MANY_REDIRECTS 302 with ELK Operator 7.10.0 using Server.basePath

I have an Elastic stack with elasticsearch and kibana version 7.10.0 using elk operator in kubernetes我有一个带有elasticsearchkibana版本7.10.0的弹性堆栈,在 kubernetes 中使用elk运算符

Whenever I enter the link https://monitoring.cloudapp.azure.com/kibana I'm getting this redirection:每当我输入链接https://monitoring.cloudapp.azure.com/kibana 时,我都会收到此重定向:

https://monitoring.cloudapp.azure.com/kibana/login?next=%2Fkibana%2Fkibana%2Flogin%3Fnext%3D%2Fkibana%2Fkibana%2Flogin%3Fnext%3D%252Fkibana%252Fkibana%

In the Pod logs:Pod日志中:

"type":"response","@timestamp":"2020-12-23T15:38:27Z","tags":,"pid":7,"method":"get","statusCode":302,"req":{"url":"/kibana/login?next=%2Fkibana%2Fkibana%2Flogin%3Fnext%3D%252Fkibana%252.....

Kibana.yaml

apiVersion: kibana.k8s.elastic.co/v1
kind: Kibana
metadata:
  name: kibana
spec:
  version: 7.10.0
  count: 1
  elasticsearchRef:
    name: elastic-https
  http:
    service:
      spec:
        type: ClusterIP
    tls:
      selfSignedCertificate:
        disabled: true
  podTemplate:
    spec:
      containers:
      - name: kibana
        env:
        - name: SERVER_BASEPATH
          value: "/kibana"
        resources:
          requests:
            memory: 4Gi
            cpu: 1
          limits:
            memory: 8Gi
            cpu: 2
    metadata:
      annotations:
        sidecar.istio.io/rewriteAppHTTPProbers: "true"

kibana.ingress.yaml

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: istio
  name: kibana-ingress
spec:
  rules:
    - host: "monitoring.cloudapp.azure.com"
      http:
        paths:
          - path: /kibana/login.*
            backend:
              serviceName: kibana-kb-http
              servicePort: 5601
          - path: /kibana
            backend:
              serviceName: kibana-kb-http
              servicePort: 5601
          - path: /kibana/*
            backend:
              serviceName: kibana-kb-http
              servicePort: 5601

No way with incognito window, I have the same problem whenever I do a kubectl port-forward I stumble upon the same problem with the redirection (with HTTP )隐身 window 没办法,每当我执行kubectl port-forward时,我都会遇到同样的问题,我偶然发现了同样的重定向问题(使用HTTP

> http://localhost:52000/kibana/login?next=%2Fkibana%2Fkibana%2Flogin%3Fnext%

The solution is to add server.rewriteBasePath: true like this解决方法是像这样添加 server.rewriteBasePath: true

---
apiVersion: kibana.k8s.elastic.co/v1
kind: Kibana
metadata:
  name: kibana
spec:
  config:
    server.rewriteBasePath: true

and update the readinessProbe like:并更新 readinessProbe 如下:

 podTemplate:
    spec:
      containers:
      - name: kibana
        readinessProbe:
          httpGet:
            scheme: HTTP
            path: /kibana
            port: 5601
        env:
        - name: SERVER_BASEPATH
          value: "/kibana"

don't forget with more than 1 replica set the redirect from / kibana to /kibana/login doesn't works不要忘记超过 1 个副本集从 /kibana 到 /kibana/login 的重定向不起作用

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

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