Intercluster RBAC with service-account

3/27/2018

Our infrastructure currently has 2 Kubernetes Cluster, with one Cluster (cluster-1) creating pods in another cluster (cluster-2). Since we are on kubernetes1.7.x, we are able to make this work.

However, with 1.8 Kubernetes added support for RBAC as a result of which we cannot create pods in the new cluster anymore.

We already added support for Service Accounts and made sure that RoleBindings are properly set-up. But the main issue is that the service-account is not propagated outside of the cluster (and rightly so). The user that cluster-2 receives the request is called 'client', so when we added a RoleBinding with 'client' as a User, everything worked.

This is most certainly not the correct solution, as now any cluster that talks to Kubernetes API server can create a pod.

Is there support for RBAC that works cross cluster? Or, is there a way to propagate the service info through to the cluster we want to create the pods in?

P.S.: Our Kubernetes cluster are currently on GKE. But, we would like this to work on all Kubernetes-engine.

-- Shaunak Godbole
google-kubernetes-engine
kubernetes

1 Answer

3/27/2018

Your cluster-1 SA uses a kubecfg (for cluster-2) which resolves to the user "client". The only way to solve this is to generate a kubecfg (for cluster-2) with an identity associated (cert/token) for your cluster-1 SA. Lot of ways to do that: https://kubernetes.io/docs/admin/authentication/

Simplest way is to create an identical SA in cluster-2 and use its token in the kubecfg in cluster-1. Give RBAC only to that SA.

-- tselvan
Source: StackOverflow