How do I install Prometheus with Helm so that it's available from the browser?

9/14/2018

I'm installing Prometheus on GKE with Helm using the standard chart as in

helm install -n prom stable/prometheus --namespace hal

but I need to be able to pull up the Prometheus UI in the browser. I know that I can do it with port forwarding, as in

kubectl port-forward -n hal svc/prom-prometheus-server 8000:80

but I'm being told "No, just expose it." Of course, there's already a service so just doing

kubectl expose deploy -n hal prom-prometheus-server

isn't going to work. I assume there's some value I can set in values.yaml that will give me an external IP, but I can't figure out what it is.

Or am I misunderstanding when they tell me "Just expose it"?

-- NickChase
kubernetes
kubernetes-helm
prometheus

2 Answers

9/14/2018

Agree that it's a bad idea to expose prom publicly, but if its a demo it's ok.

Run:

kubectl expose deploy -n hal prom-prometheus-server --type=LoadBalancer

Kubernetes will create a GCP Load Balancer with an external IP.

Hope it helps!

-- Rico
Source: StackOverflow

9/14/2018

It is generally a very bad idea to expose Prometheus itself as it has no authentication mechanism, but you can absolutely set up a LoadBalancer service or Ingress aimed at the HTTP port if you want.

More commonly (and supported by the chart) you'll use Grafana for the public view and only connect to Prom itself via port-forward when needed for debugging.

-- coderanger
Source: StackOverflow