aaw icon indicating copy to clipboard operation
aaw copied to clipboard

Investigate prometheus metrics in Lens

Open chuckbelisle opened this issue 3 years ago • 4 comments

Relates to: #1120

View prometheus metrics in Lens, found an issue that has a solution for this: https://github.com/lensapp/lens/issues/3318

kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: cluster-prometheus-proxy-creator
rules:
- apiGroups: [""]
  resources: ["services/proxy"]
  resourceNames: ["prometheus-operated:9090"]
  verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
- nonResourceURLs: ["/ui", "/ui/*", "/api/v1/namespaces/*/services/prometheus-operated:*/proxy/*"]
  verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]

chuckbelisle avatar Jun 14 '22 19:06 chuckbelisle

You can try this first it may work and is simpler:

apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: cluster-metrics-reader
rules:
- apiGroups: ["metrics.k8s.io"]
  resources: ["*"]
  verbs: ["get", "watch", "list"]
- apiGroups: ["coordination.k8s.io"]
  resources: ["*"]
  verbs: ["get", "watch", "list"]
- apiGroups: ["monitoring.coreos.com"]
  resources: ["*"]
  verbs: ["get", "watch", "list"]```

vexingly avatar Sep 07 '22 22:09 vexingly

Still not working with latest lens 6.2.6

emouawad avatar Feb 12 '23 19:02 emouawad

Same for me, I tried everything. Anyone here for rescue M

tony-engineering avatar Mar 08 '23 12:03 tony-engineering

For me this works with lens v2023.3.171731-latest:

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: some-really-cool-name
rules:
  - apiGroups:
      - ""
    resources:
      - "namespaces"
      - "nodes"
    verbs:
      - "get"
      - "list"
      - "watch"
  - apiGroups:
      - "apiextensions.k8s.io"
    resources:
      - "customresourcedefinitions"
    verbs:
      - "get"
      - "list"
      - "watch"
  - apiGroups:
      - ""
    resources:
      - "services/proxy"
    resourceNames:
      - "prometheus-operated:9090"
    verbs:
      - "get"
      - "list"
      - "watch"
      - "create"
      - "update"
      - "patch"
      - "delete"
  - apiGroups:
      - ""
    resources:
      - services
    verbs:
      - "list"

probably not the best solution, since the service account can see all services, but sufficient for me. note also: nodes and customresourcedefinitions are optional

janre avatar Mar 22 '23 11:03 janre