karmada icon indicating copy to clipboard operation
karmada copied to clipboard

Unable to join kind cluster to karmada control plane because of failing to get serviceAccount

Open Fatimastm opened this issue 3 years ago • 7 comments

What happened: I deployed karmada env with hack/local-up-karmada.sh successfuly. As it is expected, three member1, member2, and member3 have been created.

Then I just tried to join a simple kind cluster with only one control plane to the federation in push mode by running:

kubectl karmada join kind-kind --kubeconfig=$HOME/.kube/karmada.config --karmada-context=karmada --cluster-kubeconfig=$HOME/.kube/members.config --cluster-context=kind-kind

and then got this error:

Error: failed to get serviceAccount secret from cluster(kind-kind), error: failed to get serviceAccount secret, error: no specific secret found in namespace: karmada-cluster

What you expected to happen: I was expected be able to join kind-kind cluster to the karmada control plane.

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?: I also checked for kind-kind cluster client-certificate-data and client-key-data. They are available in $HOME/.kube/members.config Environment:

  • Karmada version:
  • kubectl-karmada or karmadactl version (the result of kubectl-karmada version or karmadactl version): kubectl karmada version: version.Info{GitVersion:"v1.2.1", GitTreeState:"clean", BuildDate:"2022-07-14T09:33:32Z", GoVersion:"go1.17.11", Compiler:"gc", Platform:"linux/amd64"}
  • Others:

Fatimastm avatar Oct 19 '22 12:10 Fatimastm

Hi @Fatimastm could you please tell us the following information:

  • Which Karmada version you are using?
  • What's the Kubernetes version of the kind-kind cluster?

With this information, I can try to reproduce it on my side.

I think the issue has been resolved by #1972, maybe you can try with karmadactl(or kubectl-karmada)@v1.2.2.

By the way, what's the endpoint of the kind-kind cluster? Does it use a localhost address? Like server: https://127.0.0.1:37519. Just a reminder, karmadactl can join a cluster with localhost endpoint, but after the joining process, Karmada control plane may not connect to the cluster. It is recommended to create a kind cluster by hack/create-cluster.sh, this create will uses a docker IP for kind cluster.

RainbowMango avatar Oct 20 '22 03:10 RainbowMango

Hi @RainbowMango.

  • Which Karmada version you are using? v1.2
  • What's the Kubernetes version of the kind-kind cluster? v0.16.0

It is worth to mention that, I installed the kind in docker after karmada installation because kind was not insatalled automatically with hack/local-up-karmada.sh. The endpoint of the kind-kind is like server:https://127.0.0.1:37519 and is differenet with the endpoint of karmada member clusters. Since I want to add a new kind cluster to the federation, do you recommend first create a new single cluster with hack/create-cluster.sh and then with kubectl karmada join, join it to karmada control plane?

Fatimastm avatar Oct 21 '22 07:10 Fatimastm

It is worst to mention that, I installed the kind in docker after karmada installation because kind was not insatlled automaticaly with hack/local-up-karmada.sh.

I don't get it. You can start the kind cluster before or after Karmada installation.

Since I want to add a new kind cluster to the federation, do you recommend first create a new single cluster with hack/create-cluster.sh and then with kubectl karmada join, join it to karmada control plane?

Yes, the reason why I recommend to use hack/create-cluster.sh to create kind cluster is this script will replace the endpoint of the kind cluster.

Any way, can you try again with karmadactl v1.2.2?

RainbowMango avatar Oct 21 '22 08:10 RainbowMango

Any way, can you try again with karmadactl v1.2.2

Yes. Thanks @RainbowMango. By upgrading kubectl karmada version, I was able to join my cluster tothe karmada control plane. However after 5 minutes has not been ready kind-kind Push False 5m10s.

Fatimastm avatar Oct 21 '22 09:10 Fatimastm

However after 5 minutes has not been ready kind-kind Push False 5m10s.

Is the kind-kind created by hack/create-cluster.sh?

RainbowMango avatar Oct 21 '22 09:10 RainbowMango

Is the kind-kind created by hack/create-cluster.sh

This one ( kind-kind ) is created with kind create cluster. The reason is I want to have multi worker nodes in the clsuter. I am not sure how to handle if I use hack/create-cluster.sh. Can I change the script to create a cluster with multi worker nodes?

Fatimastm avatar Oct 21 '22 09:10 Fatimastm

This one ( kind-kind ) is created with kind create cluster.

That's the reason why Karmada can't sync the cluster's healthy status. Because the Karmada control plane can't access it with a localhost endpoint.

The reason is I want to have multi worker nodes in the clsuter. I am not sure how to hnadle with it if I use hack/create-cluster.sh

Two solutions.

  1. after you create your kind cluster, you can update the endpoint in the generated kubconfig file, as per: https://github.com/karmada-io/karmada/blob/12d2a2998d44d49f5578a91c88586be12873a510/hack/create-cluster.sh#L97-L100

Then join the cluster.

  1. hack/create-cluster.sh will use a kind configuration located at here to create kind cluster. You can edit the configuration, for example, add extra nodes to it, then, create kind cluster by the script.

RainbowMango avatar Oct 21 '22 10:10 RainbowMango

@Fatimastm Does this issue be solved? Is there anything else that I can help with it?

RainbowMango avatar Dec 07 '22 07:12 RainbowMango

Yes @RainbowMango, the problem has been solved and I can manage the federation enviornment. Thank you very much.

Fatimastm avatar Dec 07 '22 09:12 Fatimastm

Thanks for your response. /close

RainbowMango avatar Dec 07 '22 09:12 RainbowMango

@RainbowMango: Closing this issue.

In response to this:

Thanks for your response. /close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

karmada-bot avatar Dec 07 '22 09:12 karmada-bot