Docs/CloudNative/Kubernetes/Base/k8s权限控制
2022-10-18 16:59:37 +08:00

27 lines
No EOL
1.4 KiB
Text
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

RBAC基于角色的访问控制--全拼Role-Based Access Control
Service Account为服务提供了一种方便的认证机制但它不关心授权的问题。可以配合RBAC来为Service Account鉴权
在Kubernetes中授权有ABAC基于属性的访问控制、RBAC基于角色的访问控制、Webhook、Node、AlwaysDeny一直拒绝和AlwaysAllow一直允许这6种模式。
在RABC API中通过如下的步骤进行授权
1定义角色在定义角色时会指定此角色对于资源的访问控制的规则
2绑定角色将主体与角色进行绑定对用户进行访问授权。
Role与ClusterRole
一个角色包含了一套表示一组权限的规则。 权限以纯粹的累加形式累积(没有"否定"的规则)。
Role:角色可以由命名空间内的Role对象定义,一个Role对象只能用于授予对某一单一命名空间中资源的访问权限
ClusterRole:整个Kubernetes集群范围内有效的角色则通过ClusterRole对象实现。
简介
role:
1、允许的操作如get,list等
2、允许操作的对象如pod,svc等
rolebinding:
将哪个用户绑定到哪个role或clusterrole上
clusterrole(集群角色)
clusterrolebinding:(绑定到集群)
3、如果使用rolebinding绑定到clusterrole上表示绑定的用户只能用于当前namespace的权限
创建k8s账号与RBAC授权使用