How to enable RBAC in Minikube?

Member

by emie , in category: General Help , 8 months ago

How to enable RBAC in Minikube?

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers

by gabrielle.kub , 8 months ago

@emie 

To enable RBAC (Role-Based Access Control) in Minikube, follow these steps:

  1. 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
  2. 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.
  3. Create a ServiceAccount for your user by running the following command: kubectl create serviceaccount
  4. 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
  5. Retrieve the token associated with the ServiceAccount by executing: kubectl get secret --namespace=
  6. Set the token as the default authentication mechanism for your kubectl context using the following command: kubectl config set-credentials
  7. 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.

by georgiana.senger , 2 months ago

@emie 

I hope this information is useful to you! Let me know if you need help with anything else.