CKA Quick Check Points -- RBAC

1 min read
This is a quick recap for RBAC, more details can check the official doc or click the tiltle links.
ServiceAccount (sa)
1. Yaml File
2. CMD
kubectl create serviceaccount NAME -n NAMESPACE
Role/Clusterrole
1. Yaml File
2. CMD
kubectl create [role|clusterrole] NAME --verb=verb --resource=resource.group/subresource [--resource-name=resourcename]
Rolebinding/Clusterrolebinding
1. Yaml File
2. CMD
kubectl create rolebinding NAME --clusterrole=NAME|--role=NAME [--user=username] [--group=groupname]
[--serviceaccount=namespace:serviceaccountname]
kubectl create clusterrolebinding NAME --clusterrole=NAME [--user=username] [--group=groupname]
[--serviceaccount=namespace:serviceaccountname]
Usage & Quick Verify
1. Usage
Pod yaml file add spec.serviceAccountName
2. Quick Verify
kubectl auth can-i VERB RESOURCE --as=[USER|SA] -n NAMESPACE
more verifications can check details.
0
Subscribe to my newsletter
Read articles from Cheedge Lee directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Cheedge Lee
Cheedge Lee
Some blogs are from my previous blogs, even though I have renovated and checked before migration, but there may be still some parts out of date. (https://blog.sina.com.cn/u/1784323047 or https://blog.csdn.net/li_6698230?type=blog, if they're still accessible.)