반응형

RBAC에서 Role은 어떻게 만들까?

오른쪽 yaml파일과 같이 Role에 대한 yaml파일을 만들고, kubectl create로 role을 생성해주면 된다.

rules에는 여러개의 key가 들어가서 여러 조건을 줄 수 있고, apiGroups은 coregroup일 경우 비워둔다.

 

role YAML을 다 작성하고 나서는? user - role간 link를 해준다.

즉, user를 role object와 linkg해주는 Role-binding이라는 yaml을 만든다.

(위 그림에서는 devuser-developer-binding.yaml)

 

subjects는 user에 대한 details를 작성하는 곳이고, roleRef는 생성된 role에 대한 정보를 작성하는 곳이다.

그리고 kubectl create -f devuser-developer-binding.yaml을 통해 binding object도 실행해준다.

role과 rolebinding간 namespace를 동일하게 맞추는 것 잊지말자.

 

role, rolebinding을 조회하는 명령어.

 

내 권한이 특정 resource에 접근 가능한지 확인하는 방법이다.

#kubectl auth can-i [ ]

 

 

resourcename에 대한 권한도 rules 아래에 줄 수 있다.

 

 

출처: Udemy 사이트의 Certified Kubernetes Administrator (CKA) with Practice Tests 강의

반응형

+ Recent posts