RBAC
Steps
- Create 2 namespaces,
foo-<ID>
andbar-<ID>
- Create a
kubectl-proxy
pod insidefoo-<ID>
, which uses the service accountfoo-<ID>:default
(the “default” service account of the namespacefoo-<ID>
)- YAML example: kubectl-proxy.yaml
- Create a service inside namespaces
foo-<ID>
andbar-<ID>
- Use
kubectl create service --help
for guidance
- Use
- Run
curl
inside the containerkubectl-proxy/main
against the API server service URL for namespacesfoo-<ID>
andbar-<ID>
- Example:
http://localhost:8001/api/v1/namespaces/default/services
- Example:
- Inside namespace
foo-<ID>
, create a roleservice-reader
, and a rolebinding for serviceaccountfoo-<ID>:default
- Run
curl
inside the containerkubectl-proxy/main
against the API server service URL for namespacesfoo-<ID>
andbar-<ID>
Reference
For more details, check the k8s-school authorization lab.