Can't access Grafana(for prometheus) via AWS ELB at Kubernetes

10/17/2018

We have a cluster of several nodes so I can't do a NodePort and just go to my node-ip (which it's what I've done for testing prometheus). I did a helm install stable/prometheus and stable/grafana at "monitoring" namespace.

Everything looks okay so far.

Then, I'm trying to create an LB service to access Grafana, which gets created, I can see the CNAME pointing to the A record for the ELB at AWS, but when accessing the URL of Grafana, nothing happens, no HTTP error, no problem page, nothing.

Here's the service-elb.yaml:

apiVersion: v1
kind: Service
metadata:
  name: grafana-lb
  namespace: monitoring
  labels:
    app: grafana
  annotations:
    dns.alpha.kubernetes.io/external: grafana-testing.country.ourdomain 
    service.beta.kubernetes.io/aws-load-balancer-ssl-cert: arn:aws:acm:xxxxxx
    service.beta.kubernetes.io/aws-load-balancer-backend-protocol: http
    service.beta.kubernetes.io/aws-load-balancer-ssl-ports: '443'
    service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout: '3600'
spec:
  selector:
    app: grafana
    tier: frontend
  type: LoadBalancer
  ports:
    - name: https
      port: 443
      targetPort: 80
    - name: http
      port: 80
      targetPort: 3000
  loadBalancerSourceRanges:
    - somerange
    - someotherrange
    - etc etc 

BTW, Got an error of permissions regarding serviceaccount if I don't create the chart with --set rbac.create=false

I recently use a nginx-proxy-pass for Kibana and also use a LB service similar to this with no issue. But I'm missing something here and can't find out what it is yet.

Any help will be much appreciated. I'll update if I make it work.

-- Rancor
amazon-web-services
grafana
kubernetes
prometheus

1 Answer

10/22/2018

Solved, had to remove the "tier" selector and just use a spec like this:

    spec:
  selector:
    app: grafana
  type: LoadBalancer
  ports:
    - name: http
      port: 3000
-- Rancor
Source: StackOverflow