#kubecost (2019-08)
Kubernetes resource and cost management
Archive: https://archive.sweetops.com/kubecost/
2019-08-19
any one ever run into the cost-analyzer-frontend container spitting the following error ?
[emerg] host not found in upstream "cost-analyzer-grafana.default.svc.cluster.local" in /etc/nginx/conf.d/default.conf:11
ah oki found teh issue
I hand global.grafana.enabled: false yet was passing a custom domain
mmm no thats not it
do you have a service called cost-analyzer-grafana
in the default
namespace?
we also dont use the built in Prometheus and grafana as we have our own running
@Jeremy G (Cloud Posse) has had pretty good success. we have it all up and running on our prometheus and grafana. @Ajay Tripathy @webb have been a huge help.
our helmfiles are up to date
Thanks, Eric. @Jan, happy to connect if we can be useful!
Thanks @Erik Osterman (Cloud Posse) I will take a look, @webb I will shout
@Jan are you still using helmfile?
Will need to check
Tomorrow
We don’t use helm file at all
2019-08-20
@Jeremy G (Cloud Posse) has joined the channel
2019-08-22
So despite setting the grafana.domainName
the nginx-conf config map still uses
upstream grafana {
server cost-analyzer-grafana.default.svc.cluster.local;
how do I change these settings from the chart?
Comprehensive Distribution of Helmfiles. Works with helmfile.d
- cloudposse/helmfiles
The settings are under global
. You need to set
global:
grafana:
enabled: false
domainName: <external domain name of your Grafana>
scheme: <http or https for accessing your Grafana>
Comprehensive Distribution of Helmfiles. Works with helmfile.d
- cloudposse/helmfiles
@Jan
2019-08-23
So I have tried those, at least in our case, I can’t seem to populate those parameters from passing arguments to the helm chart
We deploy the chart passing a values.yaml file and additional override specific things (grafana address etc)
By setting specific parameters as arguments
Even after doing so if I edit the Nginx-conf config map I see the upstream grafana value isn’t set
@Jan, any chance you can share your values.yaml file? I can try to reproduce.
I can do in a few hours
When my kids are asleep
Will need to show you how we are installing the chart
so we are installing the chart via terraform and setting two parameters while installing as well as providing two values files
data "helm_repository" "kubecost" {
url = "<https://kubecost.github.io/cost-analyzer>"
name = "kubecost"
}
resource "helm_release" "kubecost" {
name = "kubecost"
namespace = "monitoring"
chart = "kubecost/cost-analyzer"
repository = "${data.helm_repository.kubecost.name}"
set {
name = "ingress.hosts[0]"
value = "kubecost.${local.cluster_domain}"
}
set {
name = "grafana.domainName[0]"
value = "grafana.${local.cluster_domain}"
}
values = [
"${file("defaults.yaml")}",
"${file("stage.yaml")}",
]
}
so ingress.hosts works 100% as expected
grafana.domainName doesn not as I would expect
defaults.yaml:
global:
prometheus:
enabled: false
fqdn: <http://promop-prometheus-operator-prometheus.monitoring.svc.cluster.local:9090>
grafana:
enabled: false
scheme: "http"
notifications:
alertmanager:
fqdn: <http://promop-prometheus-operator-alertmanager.monitoring.svc.cluster.local:9093>
# <https://kubecost.com/install>
# This token is not really secret and can be exchanged at any time
kubecostToken: xxxxxx
serviceMonitor:
enabled: true
kubecost:
limits:
cpu: 300m
memory: 128Mi
kubecostFrontend:
limits:
cpu: 30m
memory: 56Mi
kubecostModel:
limits:
cpu: 400m
memory: 128Mi
ingress:
enabled: true
annotations:
kubernetes.io/ingress.class: traefik
grafana:
sidecar:
dashboards:
enabled: true
datasources:
enabled: true
stage.yaml is only used to enable slack notifications for specific accounts
global:
notifications:
slack:
enabled: true
webhook: <https://hooks.slack.com/services/xxxxxx>
that does almost not seem to be working currently
well it doesn’t get set
works if i set it via the kubecost site after
Thanks for sharing! You’re meaning to be using a ServiceMonitor correct? That looks like the only part I haven’t tested recently. @Jeremy G (Cloud Posse) actually has a similar config I believe.
so everything else is working fine
I just dont seem to be able to preset those parameters (slack and grafana address)
that said I have not yet pulled the chart apart
@Jan As I explained before, the setting you need is global.grafana.domainName
but you are only setting grafana.domainName
ah yea!
which I should probably just do
any idea on the slack notification where im going wrong?
The slack notification is a feature of AlertManager. If you are using your own Prometheus then you are also using your own AlertManager and have to configure Slack there.
ah I see
cheers mate
much appreciated!
Jan, looks like you got this resolved but let me know if we can help with anything else! Our product can actually integrate directly with Slack too, but we have not exposed this integration via Helm yet.
Thanks bro, I think I have everything yea