您现在的位置是:首页 > 文章详情

Kubernetes - 7.1 RBAC - Role and ClusterRole

日期:2020-03-01点击:404

什么是RBAC

RBAC全称Role-Based Access Control,是Kubernetes集群基于角色的访问控制,实现授权决策,允许通过Kubernetes API动态配置策略。

什么是Role

Role是一组权限的集合,例如Role可以包含列出Pod权限及列出Deployment权限,Role用于给某个NameSpace中的资源进行鉴权。
通过YAML资源定义清单创建Role
kubectl apply -f pod-role.yaml

apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: namespace: default name: pod-role rules: - apiGroups: [""] resources: ["pods"] verbs: ["get", "watch", "list"]

image

什么是ClusterRole

ClusterRole是一组权限的集合,但与Role不同的是,ClusterRole可以在包括所有NameSpce和集群级别的资源或非资源类型进行鉴权。
通过YAML资源定义清单创建ClusterRole
kubectl apply -f pod-clusterrole.yaml

apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: pod-clusterrole rules: - apiGroups: [""] resources: ["pods"] verbs: ["get", "watch", "list"]

image

相关参数

Role、ClsuterRole Verbs可配置参数
"get", "list", "watch", "create", "update", "patch", "delete", "exec"

Role、ClsuterRole Resource可配置参数
"services", "endpoints", "pods","secrets","configmaps","crontabs","deployments","jobs","nodes","rolebindings","clusterroles","daemonsets","replicasets","statefulsets","horizontalpodautoscalers","replicationcontrollers","cronjobs"

Role、ClsuterRole APIGroup可配置参数
"","apps", "autoscaling", "batch"

原文链接:https://yq.aliyun.com/articles/747569
关注公众号

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。

持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。

转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。

文章评论

共有0条评论来说两句吧...

文章二维码

扫描即可查看该文章

点击排行

推荐阅读

最新文章