Closed bribroder closed 1 year ago
Looks like a potential label sanitization issue. Were you able to see if other labels were available?
label 'component' did return results, but that's the only other label i've found that works--lots of other labels don't return anything:
I can't address this directly right now, but the likely workaround is to replace most punctuation-like characters with _
. Try this:
kubectl cost label -l 'app_kubernetes_io_name'
For explanation, and if someone wants to pick this up: Generally this is caused by Prometheus label sanitization. To resolve this issue, we should probably improve Kubecost's handling of queries like this to avoid confusion, but a less-good workaround is to implement the sanitization in kubectl cost
itself.
Thank you for the suggestion! I experimented with different character substitutions but couldn't find any that worked. This hypothesis also doesn't address all the unpunctuated examples above, such as 'name', 'release', 'chart', etc
That's quite odd! I'm able to see different results for kubectl cost label -l 'app_kubernetes_io_name'
and kubectl cost label -l 'chart'
in my environment, on v0.6.0 of kubectl-cost.
The next step in debugging is to check your Kubecost data, because kubectl cost label
is served by the Kubecost Allocation API. In the Kubecost UI, are you able to aggregate and/or filter by the labels you mentioned? name
, release
, chart
, etc.? Alternatively, you can run a /model/allocation query (unaggregated, please) and see if the labels show up on the workloads you expect them to.
Ahh OK, I think this is likely an issue with the underlying API and nothing to do with the kubectl cost utility--thank you for the debugging
An 'app' label query like this show several apps:
But some other label queries group everything under unallocated even though there are pods with those labels:
I get the same result for the label 'name'--is there some trick to the syntax?