Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request help: could not login grafana #2122

Closed
liuxiran opened this issue Sep 6, 2021 · 6 comments · Fixed by #2126
Closed

Request help: could not login grafana #2122

liuxiran opened this issue Sep 6, 2021 · 6 comments · Fixed by #2126

Comments

@liuxiran
Copy link
Contributor

liuxiran commented Sep 6, 2021

Issue description

TODO

Expected behavior

TODO

How to Reproduce

TODO

Screenshots

No response

Environment

  • apisix version (cmd: apisix version):
  • OS (cmd: uname -a):
  • OpenResty / Nginx version (cmd: nginx -V or openresty -V):
  • etcd version, if have (cmd: run etcd --version):
  • apisix-dashboard version, if have:
  • Browser version, if have:

Additional context

No response

@liuxiran liuxiran added the bug Something isn't working label Sep 6, 2021
@wjmmjr
Copy link
Contributor

wjmmjr commented Sep 6, 2021

问题描述:grafana单独登录正常,作了页面嵌入,可以在apisix显示,但是登录成功后又会跳转登陆界面
环境:k8s
版本:apisix-dashboard-2.7、grafana8.1.2

生产环境集成grafana有问题
grafana配置:
`

---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: grafana
  labels:
    app: grafana
spec:
  serviceName: grafana
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: grafana
  template:
    metadata:
      labels:
        app: grafana
    spec:
      containers:
        - env:
            #允许页面嵌套,可实现在apisix-dashboard中嵌套grafana
            - name: GF_SECURITY_ALLOW_EMBEDDING
              value: "true"
          name: grafana
          image: 镜像地址/grafana:8.1.2
          imagePullPolicy: Always
          livenessProbe:
            failureThreshold: 10
            httpGet:
              path: /api/health
              port: 3000
              scheme: HTTP
            initialDelaySeconds: 60
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 30
          ports:
          - containerPort: 80
            name: service
            protocol: TCP
          - containerPort: 3000
            name: grafana
            protocol: TCP
          volumeMounts:
            - mountPath: /etc/grafana/grafana.ini
              name: config-volume
              subPath: grafana.ini
            - mountPath: /var/lib/grafana/data
              name: grafana-storage
      dnsPolicy: ClusterFirst
      volumes:
        - name: config-volume
          configMap:
            name: grafana
            items:
              - key: grafana.ini
                path: grafana.ini
  volumeClaimTemplates:
    - metadata:
        name: grafana-storage
      spec:
        accessModes: [ "ReadWriteOnce" ]
        storageClassName: "gp3"
        resources:
          requests:
            storage: 10Gi

---
kind: Service
apiVersion: v1
metadata:
  name: grafana
spec:
  selector:
    app: grafana
  ports:
  - name: service
    nodePort: 32765
    port: 80
    protocol: TCP
    targetPort: 3000
  type: NodePort
  
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: grafana
  namespace: datacenter
data:
    grafana.ini: |
        [analytics]
        check_for_updates = true
        [grafana_net]
        url = https://grafana.net
        [log]
        mode = console
        [paths]
        data = /var/lib/grafana/data
        logs = /var/log/grafana
        plugins = /var/lib/grafana/plugins
        provisioning = /etc/grafana/provisioning

登录界面
eda045aa781e2ce724b56192f94a850
请求如下:
fe51f0e706be2cd31bcbbfdfc2f18e2

日志如下:
3b6cf7eed151a7b21723ea0227f4712

测试环境集成grafana没问题
正常登录请求如下:
215209ced998e38665021aba4d00d87
正常登录日志如下:
fced2e0e9764bb8543180e35d94ba14

@liuxiran
Copy link
Contributor Author

liuxiran commented Sep 6, 2021

@wjmmjr thanks for your report, let‘s have a meeting to check your environment, what time is convenient for you?

@liuxiran
Copy link
Contributor Author

liuxiran commented Sep 6, 2021

Thanks for @wjmmjr 's details, during the offline communication, I noticed that there are two sets of environments, one is for test, and another is for production, the test environment can be used normally without problems, but in the production environment, when login grafana, it will be return http code 302, and redirect to /, and in the test, we can see it will redirect to /api/live/ws

and he has tried to clear browser cache, and even change a new browser , we can exclude the browser cache.

request help from @nic-chen @imjoey , please take a look when you have time ,thanks a lot

@nic-chen
Copy link
Member

nic-chen commented Sep 6, 2021

@wjmmjr
Please confirm whether the host and port before and after logging in are the same and whether it is redirected to another address after logging in.

The other is to provide your browser information (what browser, and its version), and whether there are any error messages in the browser during this process.

@wjmmjr
Copy link
Contributor

wjmmjr commented Sep 7, 2021

my apisix-dashboard is HTTPS domain name,so when i also configure the https domain name for grafana,the problem is solved.

@liuxiran
Copy link
Contributor Author

liuxiran commented Sep 7, 2021

my apisix-dashboard is HTTPS domain name,so when i also configure the https domain name for grafana,the problem is solved.

Glad to hear that, would you like to add a FAQ to our dashboard, that will be of great help to the later users. @wjmmjr

@liuxiran liuxiran added doc and removed bug Something isn't working checking labels Sep 7, 2021
@liuxiran liuxiran mentioned this issue Sep 7, 2021
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants