Unable to connect with Loki in my homeLab

I everyone!

I’m trying to configure loki-stack in my HomeLab with kubernetes.
I can configure grafana/prometheus without problems, but I haven’t had any luck with Loki.
All resources are in the same namespace “Monitoring”

Is strange because when I do a curl since a grafana Pod
I get the response “ready”!

grafana-5f4d467645-68t25:/usr/share/grafana$ curl http://loki-stack:3100/ready
ready

But in the UI I get “Unable to connect with Loki. Please check the server logs for more details.”

In the Grafana logs I get the following error:

logger=context userId=1 orgId=1 uname=root t=2025-05-14T20:09:50.653762733-03:00 level=info msg="Request Completed" method=GET path=/api/datasources/uid/PFD47E6011A697DC0/health status=400 remote_addr=10.244.0.0 time_ms=213 duration=213.654982ms size=106 referer=https://grafana.homelab.com/connections/datasources/edit/PFD47E6011A697DC0 handler=/api/datasources/uid/:uid/health status_source=server

Has anyone had a similar situation?
I’d really appreciate it if you could help me.

Best regards!

Can you post a screenshot of your datasource configuration for Loki?

Hi Tony,
sure!

I also enclose the configuration in my Gragana configMap

    datasources:
      datasources.yaml: 
        apiVersion: 1
        datasources:
          - name: loki-home
            type: loki
            access: proxi
            url: http://loki-stack:3100
            isDefault: true

My services

Interesting, and you were able to send request from your grafana pod to loki, so it’s not connectivity.

I am not quite sure by looking at this. Can you try an actual API call from inside grafana pod to loki endpoint and see if it returns anything?

It’s really strange because it returns information without any problem. :melting_face:

Hi! finally I found the problem. It was the Loki version :melting_face:.
I had installed version 2.6.1, and in 2.9.3 this problem was fixed.
Thank you for the help!
Kind regards