diff --git a/cmd/kubeadm/app/phases/kubeconfig/kubeconfig.go b/cmd/kubeadm/app/phases/kubeconfig/kubeconfig.go index 4e4007ca704..a2c4f1743db 100644 --- a/cmd/kubeadm/app/phases/kubeconfig/kubeconfig.go +++ b/cmd/kubeadm/app/phases/kubeconfig/kubeconfig.go @@ -694,9 +694,8 @@ func EnsureAdminClusterRoleBindingImpl(ctx context.Context, adminClient, superAd ); err != nil { lastError = err if apierrors.IsAlreadyExists(err) { - // This should not happen, as the previous "create" call that uses - // the admin.conf should have passed. Return the error. - return true, err + klog.V(5).Infof("ClusterRoleBinding %s already exists.", kubeadmconstants.ClusterAdminsGroupAndClusterRoleBinding) + return true, nil } // Retry on any other type of error. return false, nil diff --git a/cmd/kubeadm/app/phases/kubeconfig/kubeconfig_test.go b/cmd/kubeadm/app/phases/kubeconfig/kubeconfig_test.go index 1c686df522f..fc2441fc0e0 100644 --- a/cmd/kubeadm/app/phases/kubeconfig/kubeconfig_test.go +++ b/cmd/kubeadm/app/phases/kubeconfig/kubeconfig_test.go @@ -850,6 +850,12 @@ func TestEnsureAdminClusterRoleBindingImpl(t *testing.T) { schema.GroupResource{}, "name") }) }, + setupSuperAdminClient: func(client *clientsetfake.Clientset) { + client.PrependReactor("create", "clusterrolebindings", func(action clientgotesting.Action) (bool, runtime.Object, error) { + return true, nil, apierrors.NewAlreadyExists( + schema.GroupResource{}, "name") + }) + }, expectedError: false, }, { @@ -916,7 +922,7 @@ func TestEnsureAdminClusterRoleBindingImpl(t *testing.T) { schema.GroupResource{}, "name") }) }, - expectedError: true, + expectedError: false, }, }