Node Authentication
- Node Authorizer
- 사용자와 kubelet의 요청을 다루는 역할
- 사용자의 요청 이름이 system node인 것과 node group의 일부에서 오는 요청들은 node authorizer에서 권한 인증함.
ABAC(Attribute Based Access Control) Authentication
- 외부 접근 사용자별 policy 생성해서 관리함
- 변경이 발생하면 매번 수정하고 kube-api server 다시 띄워야 해서 관리가 어렵다.
RBAC(Role Based Access Control) Authentication
- 권한을 역할로 생성하고, 사용자를 해당 역할과 묶음.
- K8S Cluster에서 표준화된 권한 관리 방법
Webhook Authenciation
- 권한 관리를 클러스터 외부에서 하기 위함
- 사용자가 api-server에 호출하면 외부의 agent에서 사용자에게 권한이 있는지 없는지 확인
AlwaysAllow, AlwaysDeny도 있음
- Kube-API 서버의 config에 --authorization-mode 옵션으로 줄 수가 있음
- 옵션에 선언한 순서대로 authorization check를 하여, grant가 나오면 그 뒤의 mode는 권한 체크 하지 않고 접근 가능
RBAC
- Role은 Kind: Role로 생성 가능, metadata에 누가 쓸 role인지 name: developer과 같이 정의
- Role의 세 가지 요소
- apiGroups: Core group은 blank, 나머지 그룹은 속한 group명 적음
- resources: control할 리소스
- verbs: 위의 리소스에 어떤 작업을 허락할지
- resourceNames: 어떤 리소스만 제한적으로 접근이 가능하게 할지
- 사용자에게 role을 할당하려면 kind: RoleBinding을 생성한다
- subject에는 user detail을 작성
- roleRef에는 Role 정보 작성
- 사용자와 role을 namespace에 한정적으로 접근하게 하고자 한다면 metadata에 namespace 추가. 안쓰면 default만
- kubectl get roles
- kubectl get rolebinding
- kubectl describe role developer
- kubectl describe rolebinding rb
- Access checking
- kubectl auth can-i create deployments --as dev-user : yes/no로 결과 리턴
Cluster Roles and Role Bindings
- resource들은 namespace와 cluster scoped로 분류될 수 있다.
- cluster scoped resources: nodes, PV, clusterroles, clusterrolebindings, certificatesigningrequests, namespaces
- 각각의 resource list를 확인하려면 kubectl api-resources --namespaced=true/false
- clusterroles 는 cluster scoped resources를 위한 role
- ClusterRole과 ClusterRoleBindings는 Role과 RoleBinding과 kind만 다르고 나머지는 같음
- ClusterRole과 ClusterRoleBindings는 namespaced scope에다가도 만들 수 있음. 그러면 모든 namespace의 리소스에 접근가능
'CKA' 카테고리의 다른 글
Image Security (0) | 2022.02.10 |
---|---|
Service Accounts (0) | 2021.10.16 |
API Group (0) | 2021.09.29 |
KubeConfig (0) | 2021.09.27 |
Certificates API (0) | 2021.09.25 |