While connected to the Suprvisor clster contxt, the following symptoms are present:
kubectl describe tkc <cluster name> -n <cluster namespace>
Conditions:
Last Transition Time: YYY-MM-DDTHH:MM:SSZ
Message: failed to create ClusterRoleBinding: ClusterRoleBinding.rbac.authorization.k8s.io “<role binding name>” is invalid: subjects[0].namespace: Required value
Reason: RoleBindingSyncFailed
Severity: Warning
Status: False
Type: Ready
kubectl get pods -A | grep tkg-controller
kubectl logs -n <tkg controller namespace> <tkg-controller name>
controller/rolebinding-controller "msg"="Reconciler error" "error"="failed to create ClusterRoleBinding: ClusterRoleBinding.rbac.authorization.k8s.io \"<rolebinding name>\" is invalid: subjects[0].namespace: Required value" "name"="<cluster name>" "namespace"="<cluster namespace>"
rolebinding_controller.go:124] vmware-system-tkg-controller-manager/rolebinding-controller/<cluster namespace>/<cluster name> "msg"="Failed sync/purge RoleBindings while reconciling" "error"="failed to create ClusterRoleBinding: ClusterRoleBinding.rbac.authorization.k8s.io \"<rolebinding name>\" is invalid: subjects[0].namespace: Required value"
While connected to the affected Workload Cluster context, the following symptoms are observed:
kubectl describe rolebinding <rolebinding name> -n <rolebinding namespace>
Subjects:
Kind Name Namespace
--- --- ---
ServiceAccount <account name>
vSphere with Tanzu 7.0
vSphere with Tanzu 8.0
This error is due to a user-created rolebinding in a Supervisor cluster namespace, referencing a ClusterRole "Edit" which is used by the tkg-controller to sync ClusterRolebindings to the TKC in the namespace. The rolebinding's subjects has a serviceaccount or user account specified without a namespace.
This causes the TKC to report the error of "RoleBindingSyncFailed". As a result of this error, new users/service accounts added to the vSphere namespace will not be mapped to a clusterrolebinding in the TKC.
The problematic rolebinding for the affected workload cluster will need to be corrected to include the missing namespace value.
kubectl get rolebinding -n <namespace>
kubectl edit rolebinding <rolebinding name> -n <namespace>
Subjects:
Kind Name Namespace
--- --- ---
ServiceAccount <account name>