Can't access grafana through kong ingress controller for kubernetes

770 views Asked by At

I’m trying to expose grafana application to the internet following the below steps:

helm install kong/kong --generate-name --set ingressController.installCRDs=false

  • Then applying ingress rule as below
    echo "
    apiVersion: extensions/v1beta1
    kind: Ingress
    metadata:
    name: demo
    annotations:
    kubernetes.io/ingress.class: kong
    spec:
    rules:
    - http:
    paths:
    - path: /grafana
    backend:
    serviceName: prom-stack-grafana
    servicePort: 3000
    " | kubectl apply -f -

Services are up and running correctly and pointing to the right end points

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S)
kong-1602803623-kong-proxy LoadBalancer 10.0.X.Y W.X.Y.Z 80:32218/TCP,443:30596/TCP
prom-stack-grafana ClusterIP 10.0.X.Y 3000/TCP
NAME                                      ENDPOINTS                                             
kong-1602803623-kong-proxy                10.244.X.Y:8443,10.244.X.Y:8000                    
prom-stack-grafana                        10.244.X.Y:3000  

Kong controller and ingress are running in the same namespace

  • Now the issue is that when I;m trying to access grafana through curl -i $PROXY_IP/grafana and the same from the browser"empty page after redirection to /login"

  • I got redirected to /login with no output:

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 29 100 29 0 0 82 0 --:–:-- --:–:-- --:–:-- 82HTTP/1.1 302 Found
Content-Type: text/html; charset=utf-8
Content-Length: 29
Connection: keep-alive
Cache-Control: no-cache
Expires: -1
Location: /login
Pragma: no-cache
Set-Cookie: redirect_to=%2Fgra; Path=/; HttpOnly; SameSite=Lax
X-Content-Type-Options: nosniff
X-Frame-Options: deny
X-Xss-Protection: 1; mode=block
Date: Thu, 15 Oct 2020 23:31:30 GMT
X-Kong-Upstream-Latency: 2
X-Kong-Proxy-Latency: 0
Via: kong/2.1.4

<a href="/login">Found</a>

Need to know what is missing here to get redirected to the home page of grafana

1

There are 1 answers

0
emispowder On

Have you configured the root url in Grafana?

You have configured the Ingress to serve Grafana at /grafana, so you need to let Grafana know it needs to add this as a prefix to it's paths.

Configuration slightly changes based on the version of Grafana you are using, but you will need to set root_url. If you are using a newer version of Grafana you may also need to set serve_from_sub_path and domain.