Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug ABAC to RBAC transition in a GKE kubernetes cluster?

Where does GKE log RBAC permission events?

On Google Container Engine (GKE) clusters with kubernetes version v1.6 enable RBAC authorization per default. Apparently ABAC is enabled as fallback authorization as well in order to ease the transition of existing clusters to the new authorization scheme. The idea is that first RBAC is tried to authorize an action. If that fails, this should be logged somewhere and then ABAC is consulted to allow the action. This should enabled cluster admins to inspect the logs for missed RBAC permissions before finally switching off ABAC.

We have some clusters that disable GCP logging/monitoring, instead use an own ELK stack. Just to be sure I've created a test cluster with GCP's cloud logging and monitoring, but still can's find any RBAC events anywhere. The test pod is a prometheus server that discovers and scrapes other pods and nodes.

like image 734
Johannes Kohnen Avatar asked May 11 '17 09:05

Johannes Kohnen


People also ask

How do you check RBAC in Kubernetes?

We will also assume that RBAC has been enabled in your cluster through the --authorization-mode=RBAC option in your Kubernetes API server. You can check this by executing the command kubectl api-versions ; if RBAC is enabled you should see the API version . rbac.authorization.k8s.io/v1 .

How do I give access to GKE cluster?

You can use both Identity and Access Management (IAM) and Kubernetes RBAC to control access to your GKE cluster: IAM is not specific to Kubernetes; it provides identity management for multiple Google Cloud products, and operates primarily at the level of the Google Cloud project.

How do I know if cluster role is binding?

Use the lookup command to see all Roles or ClusterRoles that are bound to a user or service account. For example, this will print the Roles and ClusterRoles for the default ServiceAccount .

Does GKE integrate with Kubernetes RBAC?

In GKE, IAM and Kubernetes RBAC are integrated to authorize users to perform actions if they have sufficient permissions according to either tool. This is an important part of bootstrapping a GKE cluster, since by default Google Cloud users do not have any Kubernetes RBAC RoleBindings.

What is RBAC in Kubernetes?

Kubernetes RBAC is a core component of Kubernetes and lets you create and grant roles (sets of permissions) for any object or type of object within the cluster. In GKE, IAM and Kubernetes RBAC are integrated to authorize users to perform actions if they have sufficient permissions according to either tool.

How do I enable Azure RBAC for Kubernetes authorization?

To use Azure RBAC for Kubernetes Authorization, Azure Active Directory integration must be enabled on your cluster. For more, see Azure Active Directory integration. To add Azure RBAC for Kubernetes Authorization into an existing AKS cluster, use the az aks update command with the flag enable-azure-rbac.

Do clustered kubernetes clusters use ABAC policies?

Clusters that originally ran older Kubernetes versions often used permissive ABAC policies, including granting full API access to all service accounts.


1 Answers

To make this more comprehensive. From Using RBAC Authorization:

When run with a log level of 2 or higher (--v=2), you can see RBAC denials in the apiserver log (prefixed with RBAC DENY:).

In GKE the apiservers logs can be accessed via HTTP like:

kubectl proxy &
curl -s http://localhost:8001/logs/kube-apiserver.log
like image 114
jayme Avatar answered Oct 05 '22 01:10

jayme