openfaas / faas-netes

Serverless Functions For Kubernetes
https://www.openfaas.com
MIT License
2.12k stars 473 forks source link

Expose prometheus service type #617

Closed feiniao0308 closed 4 years ago

feiniao0308 commented 4 years ago

Expose prometheus service type to values.yaml

Expected Behaviour

User should be able to specify the service type of prometheus to LoadBalancer, so that all users can access the metrics via LoadBalancer http url

Current Behaviour

It's hardcode to ClusterIP

Possible Solution

Extract the service type to values.yaml

Steps to Reproduce (for bugs)

  1. Deploy OpenFaaS in kubernetes 2.kubectl get svc and find prometheus is ClusterIP which can only be accessed via port forwarding.

Context

Your Environment

alexellis commented 4 years ago

Thanks for your interest.

Given that Prometheus has no auth, exposing it to the internet directly sounds like a bad idea.

You should be using Ingress so that you can also obtain a TLS certificate.

If you really want to view Prometheus, people usually use kubectl port-forward or Grafana.

Closing as this issue as it encourages unsafe practices.

Alex

feiniao0308 commented 4 years ago

@alexellis I think the user will take the risk to expose the URL. Here's the scenario why user need to access the prometheus URL. Some users may have another global Grafana not in same cluster with prometheus, or user may need to pull the prometheus metrics and use other monitoring tools(such as Wavefront) to monitor the health of openfaas.

OpenFaaS should provide flexible configuration for end user. I can see most helm charts has provided service as configurable.

feiniao0308 commented 4 years ago

@alexellis can we support it?

alexellis commented 4 years ago

Just to reiterate what I said, because it doesn't seem to be clear: exposing Prometheus as a LoadBalancer on the Internet is insecure, I don't want to enable that use-case.

You can very easily add an Ingress definition and secure the endpoint, adding TLS and basic-auth using nginx-ingress.

Alternatively, you can use kubectl port-forward svc/prometheus -n openfaas 9090:9090.

alexellis commented 4 years ago

If you need technical support with Kubernetes, try the Kubernetes Slack, it's a friendly community. https://slack.k8s.io