no premisstion
time="2025-01-12T05:05:16Z" level=error msg="received error while fetching metrics: nodes is forbidden: User "system:serviceaccount:loadwatcher:default" cannot list resource "nodes" in API group "" at the cluster scope" func="github.com/paypal/load-watcher/pkg/watcher.(*Watcher).StartWatching.func1" file="/go/src/github.com/paypal/load-watcher/pkg/watcher/watcher.go:136" time="2025-01-12T05:05:16Z" level=error msg="received error while fetching metrics: nodes is forbidden: User "system:serviceaccount:loadwatcher:default" cannot list resource "nodes" in API group "" at the cluster scope" func="github.com/paypal/load-watcher/pkg/watcher.(*Watcher).StartWatching.func1" file="/go/src/github.com/paypal/load-watcher/pkg/watcher/watcher.go:136" time="2025-01-12T05:05:16Z" level=error msg="received error while fetching metrics: nodes is forbidden: User "system:serviceaccount:loadwatcher:default" cannot list resource "nodes" in API group "" at the cluster scope" func="github.com/paypal/load-watcher/pkg/watcher.(*Watcher).StartWatching.func1" file="/go/src/github.com/paypal/load-watcher/pkg/watcher/watcher.go:136"
I have added
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: metrics-reader
rules:
- apiGroups: ["metrics.k8s.io"]
resources: ["nodes"]
verbs: ["get", "list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: metrics-reader-binding
subjects:
- kind: ServiceAccount
name: default
namespace: loadwatcher
roleRef:
kind: ClusterRole
name: metrics-reader
apiGroup: rbac.authorization.k8s.io
Proper rules should look like this:
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: metrics-reader
rules:
- apiGroups: ["metrics.k8s.io"]
resources: ["nodes"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["nodes"]
verbs: ["get", "list", "watch"]