Question

loki grafana, ingress and namespace

Posted August 18, 2020 1.6k views
Load BalancingLoggingKubernetes

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
...

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.

×
Submit an Answer
1 answer

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