我使用的 kubernetes dasboard 版本:v1.10.1
当我转到“角色”选项卡时,我可以看到 ClusterRoles 和 Roles 的列表。
我想从列表中查看有关特定角色的更多详细信息,但我没有看到任何“详细信息”按钮。我想在仪表板小部件甚至 yaml 格式中查看有关角色的信息。我是否遗漏了某些内容,或者这无法通过仪表板实现?
不幸的是,即使在最新版本上,也无法实现您在 Kubernetes 仪表板中描述的内容。
要列出集群上的所有角色,您需要使用命令行工具(kubectl):
kubectl get rolebindings,clusterrolebindings --all-namespaces -o custom-columns='KIND:kind,NAMESPACE:metadata.namespace,NAME:metadata.name,SERVICE_ACCOUNTS:subjects[?(@.kind=="ServiceAccount")].name'
您可以像本示例中那样提取 yaml 文件:
kubectl get clusterrolebindings prometheus -o yaml
或者你可以简单描述一下:
kubectl describe clusterrolebindings prometheus
我知道为时已晚,但可能会对使用新版本的人有所帮助。这个我试过了
v1.27.2
kubectl describe clusterrole <Name of the Cluster Role>
例如 - 使用新创建的名为 testrole 的角色,我已将其指定为仅创建部署和有状态集。
kubectl describe clusterrole testrole
$ kubectl describe clusterrole testrole
Name: testrole
Labels: <none>
Annotations: <none>
PolicyRule:
Resources Non-Resource URLs Resource Names Verbs
--------- ----------------- -------------- -----
deployments.apps [] [] [create]
statefulsets.apps [] [] [create]