RBAC
Author: Fabrice JAMMES (LinkedIn).
1. Create Namespaces
Create two namespaces:
foo-<ID>bar-<ID>
2. Deploy curl-custom-sa Pod
Create a curl-custom-sa pod inside the foo-<ID> namespace, using the service account foo-<ID>:default (the default service account of foo-<ID>).
Use the following example YAML file: Proxy Pod YAML Example
3. Create Services in Both Namespaces
Create a service inside both namespaces (foo-<ID> and bar-<ID>).
4. Test Access via curl-custom-sa
Run curl inside the curl-custom-sa container to query the API server for services in foo-<ID> and bar-<ID>.
5. Create Role and RoleBinding
Inside foo-<ID>, create:
- A Role named 
service-readerthat grants read access to services. - A RoleBinding to bind 
foo-<ID>:defaultservice account to theservice-readerrole. 
6. Test Role Access via  curl-custom-sa pod
Expected Outcome:
curltofoo-<ID>should succeed.curltobar-<ID>should be forbidden, since the role only grants access to services infoo-<ID>.
Access to full solution
https://github.com/k8s-school/k8s-advanced/blob/master/labs/2_authorization/2_0_RBAC_simple.sh