Kubernetes - 7.1 RBAC - Role and ClusterRole
什么是RBAC
RBAC全称Role-Based Access Control,是Kubernetes集群基于角色的访问控制,实现授权决策,允许通过Kubernetes API动态配置策略。
什么是Role
Role是一组权限的集合,例如Role可以包含列出Pod权限及列出Deployment权限,Role用于给某个NameSpace中的资源进行鉴权。
通过YAML资源定义清单创建Rolekubectl 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"]
什么是ClusterRole
ClusterRole是一组权限的集合,但与Role不同的是,ClusterRole可以在包括所有NameSpce和集群级别的资源或非资源类型进行鉴权。
通过YAML资源定义清单创建ClusterRolekubectl 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"]
相关参数
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"
低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。
持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。
转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。
- 上一篇
Kubernetes - 6.4 Config and Storage - Serivce Account
什么是Service Account Service Account是为了解决Kubernetes集群内部资源认证问题而诞生,例如Pod的进程想调用Kubernetes API或者其他外部服务。 Service Account基本操作 通过kubectl创建ServiceAccountkubectl create sa nginx-sa 可以见到创建了ServiceAccount之后也自动创建了Secret对象并自动引用了 将Service Account绑定到Pod kubectl apply -f nginx-pod-sa.yaml apiVersion: v1 kind: Pod metadata: name: nginx-pod spec: containers: - name: nginx image: nginx:1.16 serviceAccountName: nginx-sa
- 下一篇
Kubernetes - 7.2 RBAC - RoleBinding
什么是RoleBinding RoleBinding通过已经定义的Role权限授予到用户、用户组,从而让用户获得在NameSpace对应的操作资源权限。 RoleBinding基本操作 通过YAML资源定义清单创建RoleBindingkubectl apply -f pod-rolebinding.yaml apiVersion: rbac.authorization.k8s.io/v1beta1 kind: RoleBinding metadata: name: pod-rolebinding namespace: default subjects: - kind: User name: carry apiGroup: rbac.authorization.k8s.io roleRef: kind: Role name: pod-role apiGroup: rbac.authorization.k8s.io #### 什么是ClusterRoleBindingClusterRoleBinding通过已经定义的ClusterRole权限授予到用户或用户组,从而让用户获得集群内对应的...
相关文章
文章评论
共有0条评论来说两句吧...
文章二维码
点击排行
推荐阅读
最新文章
- CentOS7,8上快速安装Gitea,搭建Git服务器
- SpringBoot2整合MyBatis,连接MySql数据库做增删改查操作
- Docker安装Oracle12C,快速搭建Oracle学习环境
- Windows10,CentOS7,CentOS8安装Nodejs环境
- Springboot2将连接池hikari替换为druid,体验最强大的数据库连接池
- CentOS7,CentOS8安装Elasticsearch6.8.6
- CentOS8安装Docker,最新的服务器搭配容器使用
- 设置Eclipse缩进为4个空格,增强代码规范
- CentOS7安装Docker,走上虚拟化容器引擎之路
- CentOS7设置SWAP分区,小内存服务器的救世主