Report this

What is the reason for this report?

loki grafana, ingress and namespace

Posted on August 18, 2020

I’ve installed from marketplace Grafana Loki into an existing cluster. I’d want to add /log entry into my ingress in order to point to loki-grafana service.

Here’s an extract of my ingress:

» kubectl get ingress/app -o yaml

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: nginx
...
  name: app
  namespace: default
...
spec:
  rules:
  - host: ***.com
    http:
      paths:
      - backend:
          serviceName: api
          servicePort: 80
        path: /api
      - backend:
          serviceName: static
          servicePort: 80
        path: /assets
...
      - backend:
          serviceName: fe
          servicePort: 80
        path: /
      - backend:
          serviceName: loki-grafana
          servicePort: 80
        path: /log
status:
  loadBalancer:
    ingress:
    - ip: ***

but I got an error:

» kubectl describe ingress/app
Name:             app
Namespace:        default
..
Rules:
  Host                     Path  Backends
  ----                     ----  --------
  ***  
                           /api           api:80 (***:3000)
...
                           /log           loki-grafana:80 (<error: endpoints "loki-grafana" not found>)
Annotations:               kubernetes.io/ingress.class: nginx
                           meta.helm.sh/release-name: qme
                           meta.helm.sh/release-namespace: default
                           nginx.ingress.kubernetes.io/ssl-redirect: false
                           nginx.ingress.kubernetes.io/use-regex: true

Maybe the problem is that the loki-grafana service is on another namespace?

» kubectl describe services/loki-grafana -n loki 
Name:              loki-grafana
Namespace:         loki
...


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello @batdevis

To store nginx logs in Grafana Loki you need to make sure all resources are in the same namespace. Try to add the Nginx and Grafana Loki in the same namespace “loki”.

I hope it helps!

Best Regards, Purnima Kumari

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.