kubecost / cost-analyzer-helm-chart

Kubecost helm chart
http://kubecost.com/install
Apache License 2.0
483 stars 416 forks source link

[OpenShift]: Using the existing Prometheus in an OpenShift cluster? #3690

Open kastl-ars opened 1 week ago

kastl-ars commented 1 week ago

Hi all,

is it possible to use the Prometheus instance that is already running in an OpenShift cluster?

I found some issues (#752 , #2128) related to OpenShift and not using the kubecost-bundled prometheus. So I guess it could be possible, but those issues contain no hint if they succeeded without workarounds.

I would prefer to not run Prometheus twice and do all the scraping twice.

If this is possible, it would be nice if this could be included in the documentation. https://docs.kubecost.com/install-and-configure/install/provider-installations/openshift-kubecost-install

Kind Regards, Johannes

kastl-ars commented 1 week ago

Hmmm, no matter what I try, I cannot get the kubecost-cost-analyzer to talk to Prometheus respective the thanos-querier service. No matter which kind of authentication I try, it always errors out.

kastl-ars commented 1 week ago

Add a ClusterRoleBinding to have the kubecost-cost-analyzer serviceAccount gain the cluster-monitoring-view role did not help. Or would I need to somehow enable authentication in the values.yaml?

kastl-ars commented 1 week ago

This comment looks like the missing piece (to me). Have the cost-analyzer use the serviceAccount token from inside the pod.

https://github.com/kubecost/cost-analyzer-helm-chart/issues/2128#issuecomment-1505758785

chipzoller commented 1 week ago

I'm not sure it's possible to do this, but we don't recommend doing so either. The bundled Prometheus instance with Kubecost is configured to only scrape what is needed for Kubecost and so it won't be a 100% duplication of effort compared to the existing instance.

chipzoller commented 1 week ago

@jessegoodier might have more info here

kastl-ars commented 1 week ago

I'm not sure it's possible to do this, but we don't recommend doing so either. The bundled Prometheus instance with Kubecost is configured to only scrape what is needed for Kubecost and so it won't be a 100% duplication of effort compared to the existing instance.

Thanks for the information. It seems a waste to have two instances running, but if it is not possible then I'll have to bite the bullet.

jessegoodier commented 1 week ago

We are doing some research on this again. Will update here when we have more details. @mittal-ishaan FYI