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

Argument namespaces-denylist produces an error with v2.10.0 #2187

Closed
BernhardGruen opened this issue Sep 11, 2023 · 5 comments · Fixed by #2190
Closed

Argument namespaces-denylist produces an error with v2.10.0 #2187

BernhardGruen opened this issue Sep 11, 2023 · 5 comments · Fixed by #2190
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@BernhardGruen
Copy link

What happened:

I upgraded kube-state-metrics from 2.9.2 to 2.10.0 on several clusters. On a single cluster it did not work as expected.

This is the error message I got there:

W0908 12:40:15.252401       1 reflector.go:533] pkg/mod/k8s.io/client-go@v0.27.5/tools/cache/reflector.go:231: failed to list *v1.Node: field label not supported: metadata.namespace
E0908 12:40:15.252471       1 reflector.go:148] pkg/mod/k8s.io/client-go@v0.27.5/tools/cache/reflector.go:231: Failed to watch  *v1.Node: failed to list *v1.Node: field label not supported: metadata.namespace
W0908 12:40:39.965420       1 reflector.go:533] pkg/mod/k8s.io/client-go@v0.27.5/tools/cache/reflector.go:231: failed to list *v1.CertificateSigningRequest: field label not supported: metadata.namespace
E0908 12:40:39.965531       1 reflector.go:148] pkg/mod/k8s.io/client-go@v0.27.5/tools/cache/reflector.go:231: Failed to watch *v1.CertificateSigningRequest: failed to list *v1.CertificateSigningRequest: field label not supported: metadata.namespace                               
W0908 12:40:52.773607       1 reflector.go:533] pkg/mod/k8s.io/client-go@v0.27.5/tools/cache/reflector.go:231: failed to list *v1.Namespace: field label not supported: metadata.namespace
E0908 12:40:52.773671       1 reflector.go:148] pkg/mod/k8s.io/client-go@v0.27.5/tools/cache/reflector.go:231: Failed to watch *v1.Namespace: failed to list *v1.Namespace: field label not supported: metadata.namespace

Also on that cluster metrics like kube_node_info do not exist anymore (this correlates to the error message about v1.Node does not have a field label metadata.namespace).

There is a single difference in configuration - the use of --namespaces-denylist=NAMESPACE_TO_EXCLUDE. Therefore I assume that this configuration produces the error. If I remove that configuration option it also works on that exact cluster.

What you expected to happen:

I expect to have metrics like kube_node_info and no exported metrics for namespaces on the denylist.

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

One just have to add the command line argument --namespaces-denylist=NAMESPACE_TO_EXCLUDE. It does not matter if the namespace exists or not.

Environment:

  • kube-state-metrics version: 2.10.0
  • Kubernetes version (use kubectl version): 1.27.x (also tested on 1.26.x)
  • Cloud provider or hardware configuration: Scaleway, DigitalOcean
  • The image was provided by bitnami: docker.io/bitnami/kube-state-metrics:2.10.0-debian-11-r0 (but I don't think this makes a difference)
@BernhardGruen BernhardGruen added the kind/bug Categorizes issue or PR as related to a bug. label Sep 11, 2023
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Sep 11, 2023
@mrueg
Copy link
Member

mrueg commented Sep 11, 2023

Thanks for the report!
The resources you mentioned are non-namespaced resources.
I could track it down to this c3c5528
It looks like my change had some unintended results as I wasn't considering the namespace-denyfilter here.

@mrueg
Copy link
Member

mrueg commented Sep 11, 2023

/triage accepted
/assign mrueg

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Sep 11, 2023
mrueg added a commit to mrueg/kube-state-metrics that referenced this issue Sep 11, 2023
This should resolve the issue with namespace-denylist as discovered in kubernetes#2187

Regression introduced in kubernetes@c3c5528

Signed-off-by: Manuel Rüger <manuel@rueg.eu>
@mrueg
Copy link
Member

mrueg commented Sep 11, 2023

Can you test with #2189 please? @BernhardGruen

@BernhardGruen
Copy link
Author

I can confirm that this version runs without an error message and kube_node_info is also present. Thank you for your really fast reaction.

I did not dig any further in the code but aren't there more non-namespaced objects that need that patch too like mutatingwebhookconfiguration, persistentvolume, clusterrole, validatingwebhookconfiguration, volumeattachment.

@mrueg
Copy link
Member

mrueg commented Sep 11, 2023

Yes that is correct. I wanted to verify that the change is resolving the issue before changing them as well :)

edit: Likely someone else will take that over as I won't be able to do it before my travels.

mrueg added a commit to mrueg/kube-state-metrics that referenced this issue Sep 11, 2023
This should resolve the issue with namespace-denylist as discovered in kubernetes#2187

Regression introduced in kubernetes@c3c5528

Signed-off-by: Manuel Rüger <manuel@rueg.eu>
dgrisonnet pushed a commit to dgrisonnet/kube-state-metrics that referenced this issue Sep 12, 2023
This should resolve the issue with namespace-denylist as discovered in kubernetes#2187

Regression introduced in kubernetes@c3c5528

Signed-off-by: Manuel Rüger <manuel@rueg.eu>
rexagod pushed a commit to rexagod/kube-state-metrics that referenced this issue Sep 12, 2023
This should resolve the issue with namespace-denylist as discovered in kubernetes#2187

Regression introduced in kubernetes@c3c5528

Signed-off-by: Manuel Rüger <manuel@rueg.eu>
rexagod pushed a commit to rexagod/kube-state-metrics that referenced this issue Oct 8, 2023
This should resolve the issue with namespace-denylist as discovered in kubernetes#2187

Regression introduced in kubernetes@c3c5528

Signed-off-by: Manuel Rüger <manuel@rueg.eu>
rexagod pushed a commit to rexagod/kube-state-metrics that referenced this issue Oct 8, 2023
This should resolve the issue with namespace-denylist as discovered in kubernetes#2187

Regression introduced in kubernetes@c3c5528

Signed-off-by: Manuel Rüger <manuel@rueg.eu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
3 participants