diff --git a/internal/manifests/collector/parser/processor/processor_k8sattributes.go b/internal/manifests/collector/parser/processor/processor_k8sattributes.go index 293411acbf..5c59f857bd 100644 --- a/internal/manifests/collector/parser/processor/processor_k8sattributes.go +++ b/internal/manifests/collector/parser/processor/processor_k8sattributes.go @@ -62,6 +62,10 @@ func (o *K8sAttributesParser) GetRBACRules() []rbacv1.PolicyRule { Resources: []string{"replicasets"}, Verbs: []string{"get", "watch", "list"}, }, + { + NonResourceURLs: []string{"/metrics"}, + Verbs: []string{"get"}, + }, } extractCfg, ok := o.config["extract"] diff --git a/internal/manifests/collector/parser/processor/processor_k8sattributes_test.go b/internal/manifests/collector/parser/processor/processor_k8sattributes_test.go index c6328cc51f..795f148b16 100644 --- a/internal/manifests/collector/parser/processor/processor_k8sattributes_test.go +++ b/internal/manifests/collector/parser/processor/processor_k8sattributes_test.go @@ -45,6 +45,10 @@ func TestK8sAttributesRBAC(t *testing.T) { Resources: []string{"replicasets"}, Verbs: []string{"get", "watch", "list"}, }, + { + NonResourceURLs: []string{"/metrics"}, + Verbs: []string{"get"}, + }, }, }, { @@ -67,6 +71,10 @@ func TestK8sAttributesRBAC(t *testing.T) { Resources: []string{"replicasets"}, Verbs: []string{"get", "watch", "list"}, }, + { + NonResourceURLs: []string{"/metrics"}, + Verbs: []string{"get"}, + }, { APIGroups: []string{""}, Resources: []string{"nodes"},