snippetkubernetesMinor
kubernetes: how to set "top node" and "top pod" permissions?
Viewed 0 times
permissionstopnodekuberneteshowandpodset
Problem
Hoping for some pointers, I have a question: what role/permissions do I need to bind to a user that has ClusterRole=view in order to let that user use
My team are using kubectl version 1.15.x (client) on a 1.15.7 cluster (AKS), although I'm not sure if that's relevant information. I tried to find this in the k8s documentation, but could not find the permission-reference description, only some examples and guidelines. If you know where to get the full k8s reference, I'm equally glad and will post the solution.
Note, I also posted this on StackOverflow, but they pointed me here, which indeed looks much more suited.
Thanks in advance!
Regards, Ludo
top node and top pod commands in kubectl? My team are using kubectl version 1.15.x (client) on a 1.15.7 cluster (AKS), although I'm not sure if that's relevant information. I tried to find this in the k8s documentation, but could not find the permission-reference description, only some examples and guidelines. If you know where to get the full k8s reference, I'm equally glad and will post the solution.
Note, I also posted this on StackOverflow, but they pointed me here, which indeed looks much more suited.
Thanks in advance!
Regards, Ludo
Solution
Thanks to arghya-sadhu's comments on stackoverflow, I've got it working:
(I'm aggregating to the standard 'view' role)
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: get-pod-and-node
labels:
rbac.authorization.k8s.io/aggregate-to-view: "true"
rules:
- apiGroups: ["metrics.k8s.io"]
resources: ["pods", "nodes"]
verbs: ["get", "watch", "list"](I'm aggregating to the standard 'view' role)
Code Snippets
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: get-pod-and-node
labels:
rbac.authorization.k8s.io/aggregate-to-view: "true"
rules:
- apiGroups: ["metrics.k8s.io"]
resources: ["pods", "nodes"]
verbs: ["get", "watch", "list"]Context
StackExchange DevOps Q#10698, answer score: 3
Revisions (0)
No revisions yet.