Kubernetes CKA sample exam question 104 with answer

Question
Create a role called dev-user-role in the dev namespace which can list all the pods and deployments.
Create necessary role binding for service account dev-sa.

Answer
This can be done in three steps:

kubectl create sa dev-sa -n dev
kubectl create role dev-user-role -n dev --resource=pods,deployments --verb=list
kubectl create rolebinding dev-user-role-binding -n dev --role=dev-user-role --serviceaccount=dev:dev-sa