@emie
To enable RBAC (Role-Based Access Control) in Minikube, follow these steps:
- Start by checking if your Minikube cluster supports RBAC by running the following command:
minikube addons list
Look for the rbac addon in the list. If it's not enabled, you can enable it by running:
minikube addons enable rbac
- Verify that RBAC is enabled in the cluster by executing:
kubectl get pod --namespace=kube-system
Look for the kube-apiserver-minikube pod. Ensure that the RBAC admission plugin is present in the list of enabled admission plugins.
- Create a ServiceAccount for your user by running the following command:
kubectl create serviceaccount
- Next, create a ClusterRoleBinding for the ServiceAccount, which maps the ServiceAccount to a ClusterRole with the necessary permissions. Run the following command:
kubectl create clusterrolebinding
- Retrieve the token associated with the ServiceAccount by executing:
kubectl get secret --namespace=
- Set the token as the default authentication mechanism for your kubectl context using the following command:
kubectl config set-credentials
- Finally, you can set the user and context to use the ServiceAccount:
kubectl config set-context
Once these steps are completed, RBAC will be enabled in Minikube, and you can use the defined ServiceAccount to authenticate and perform operations in your cluster.