Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kube_deployment_labels metric missing DEPLOYMENT_LABEL labels #1489

Closed
cwrau opened this issue May 26, 2021 · 4 comments · Fixed by #1988
Closed

kube_deployment_labels metric missing DEPLOYMENT_LABEL labels #1489

cwrau opened this issue May 26, 2021 · 4 comments · Fixed by #1988

Comments

@cwrau
Copy link

cwrau commented May 26, 2021

What happened:

After updating to kube-state-metrics v2.0.0 the extra labels, as described in https://github.com/kubernetes/kube-state-metrics/blob/release-2.0/docs/deployment-metrics.md, are missing. Meaning only deployment and namespace labels are set.

What you expected to happen:

As they are in the above mentioned documentation and also not in the deprecation notice, I expected them to still exist

How to reproduce it (as minimally and precisely as possible):

Run kube-state-metrics and search for kube_deployment_labels in its metric endpoint

Anything else we need to know?:

Environment:

  • kube-state-metrics version: v2.0.0
  • Kubernetes version (use kubectl version): v1.18.0
  • Cloud provider or hardware configuration: Does not apply
  • Other info:
@cwrau cwrau added the kind/bug Categorizes issue or PR as related to a bug. label May 26, 2021
@cwrau cwrau changed the title kube_deployment_labels missing DEPLOYMENT_LABEL labels kube_deployment_labels metric missing DEPLOYMENT_LABEL labels May 26, 2021
@lilic
Copy link
Member

lilic commented Jun 1, 2021

Hey, it's not a bug but a new future as mentioned in the release notes these are now under an allow-list.

--metric-labels-allowlist string Comma-separated list of additional Kubernetes label keys that will be used in the resource' labels metric. By default the metric contains only name and namespace labels. To include additional labels provide a list of resource names in their plural form and Kubernetes label keys you would like to allow for them (Example: '=namespaces=[k8s-label-1,k8s-label-n,...],pods=[app],...)'. A single '*' can be provided per resource instead to allow any labels, but that has severe performance implications (Example: '=pods=[*]').

Please suggest a place where we can put this as we had few people ask about it, thank you!

@lilic lilic removed the kind/bug Categorizes issue or PR as related to a bug. label Jun 1, 2021
@cwrau
Copy link
Author

cwrau commented Jun 1, 2021

Huh, interesting, I must have glossed over that during my reading of https://kubernetes.io/blog/2021/04/13/kube-state-metrics-v-2-0/

Although now I can clearly see that in the post 😅

Sorry for the wrong(?) bug report and thanks for the info 👍️

In case anyone is needing the same labels as us, we needed to add the following argument to kube-state-metrics;

--metric-labels-allowlist=pods=[app.kubernetes.io/name,app.kubernetes.io/component,app.kubernetes.io/instance],deployments=[app.kubernetes.io/name,app.kubernetes.io/component,app.kubernetes.io/instance]

@ycyin
Copy link

ycyin commented Sep 8, 2023

It work for me of add --metric-labels-allowlist=pods=[app] in v2.2.0, no need to add it under v2.x.x. app is my pod label name,you can set *

@paltaa
Copy link

paltaa commented May 14, 2024

If you want all the metrics to have the pod labels defined in --metric-labels-allowlist=pods=[]:

Add t his relabel configs:

      relabelConfigs:
        - action: labelmap
          regex: __meta_kubernetes_pod_label_(.+)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants