Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

karmadactl unjoin doesn't delete agent when unjoinning a pull mode cluster #801

Open
dddddai opened this issue Oct 12, 2021 · 16 comments · May be fixed by #6081
Open

karmadactl unjoin doesn't delete agent when unjoinning a pull mode cluster #801

dddddai opened this issue Oct 12, 2021 · 16 comments · May be fixed by #6081
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@dddddai
Copy link
Member

dddddai commented Oct 12, 2021

What happened:
When unjoining a pull mode cluster, the resources associated with agent still remain in the unjonning cluster.

What you expected to happen:
karmadactl unjoin should clean up resources associated with agent from the unjoining pull mode cluster

How to reproduce it (as minimally and precisely as possible):
1.Set up environment

root@myserver:~/karmada# hack/local-up-karmada.sh

root@myserver:~/karmada# hack/create-cluster.sh member1 $HOME/.kube/karmada.config

root@myserver:~/karmada# kubectl config use-context karmada-apiserver

2.Join member1 in pull mode

root@myserver:~/karmada# hack/deploy-karmada-agent.sh $KUBECONFIG karmada-apiserver $KUBECONFIG member1

root@myserver:~/karmada# kubectl get cluster
NAME      VERSION   MODE   READY   AGE
member1   v1.19.1   Pull   True    3m19s

3.Unjoin member1

root@myserver:~/karmada# karmadactl unjoin member1 --cluster-kubeconfig=$KUBECONFIG

root@myserver:~/karmada# kubectl get cluster
No resources found

4.Check the resources associated with karmada agent

root@myserver:~/karmada# kc get deploy -n karmada-system --context member1
NAME            READY   UP-TO-DATE   AVAILABLE   AGE
karmada-agent   1/1     1            1           5m34s

root@myserver:~/karmada# kc get clusterrole karmada-agent --context member1
NAME            CREATED AT
karmada-agent   2021-10-12T01:39:26Z

root@myserver:~/karmada# kc get clusterrolebinding karmada-agent --context member1
NAME            ROLE                        AGE
karmada-agent   ClusterRole/karmada-agent   6m2s

They still remain in the unjoining cluster, is it an oversight or intention?

Anything else we need to know?:

Environment:

  • Karmada version: v0.8.0
  • Others:
@dddddai dddddai added the kind/bug Categorizes issue or PR as related to a bug. label Oct 12, 2021
@RainbowMango
Copy link
Member

I suppose talking about the solutions at the community meeting. So could you add an agenda to the meeting docs?

@dddddai
Copy link
Member Author

dddddai commented Nov 8, 2021

Sure, thanks for the attention!

@jwcesign
Copy link
Member

I tried, and the agent will be kept, I think this issue needs to be tracked.

/assign

@jwcesign
Copy link
Member

cc @lonelyCZ , why did we close the related PR?

@lonelyCZ
Copy link
Member

Hi @jwcesign , I think the key point is that karmada-agent may be not deployed in karmada-system namespace, and we possibily don't have kubeconfig of member cluster with PULL mode in Karmada control plane.

So we don't need to relize karmadactl unjoin for PULL mode, it is more like kubeadm reset for deleting Node, firstly reset the node, and then delete the object in kubernetes control plane.

What do you think?

@jwcesign
Copy link
Member

jwcesign commented Apr 26, 2023

Can we determine if the agent was installed by Karmada or manually?

I think that if Karmada installs it, then it should be uninstalled upon executing the 'unjoin' command.

@jwcesign
Copy link
Member

jwcesign commented May 4, 2023

what do you think? @lonelyCZ

@lonelyCZ
Copy link
Member

lonelyCZ commented May 4, 2023

Can we determine if the agent was installed by Karmada or manually?

Currently, the karmada-agent can be installed by karmadactl register or writing yaml file.

I think that if Karmada installs it, then it should be uninstalled upon executing the 'unjoin' command.

Where should we executing unjoin command, Karmada control plane or the member cluster? And we possibily could not access the PULL mod member cluster from Karmada control plane.

@jwcesign
Copy link
Member

jwcesign commented May 4, 2023

Where should we executing unjoin command, Karmada control plane or the member cluster? And we possibily could not access the PULL mod member cluster from Karmada control plane.

I think when to execute this: karmadactl unjoin CLUSTER_NAME --cluster-kubeconfig=<KUBECONFIG> for pull mode.
With this command, we could delete the agent.

@lonelyCZ
Copy link
Member

lonelyCZ commented May 4, 2023

I think when to execute this: karmadactl unjoin CLUSTER_NAME --cluster-kubeconfig= for pull mode.
With this command, we could delete the agent.

Got it. Like #929 . What do you think this PR? The key point seems the namespace or name of karmada-agent in the member cluster.

@jwcesign
Copy link
Member

jwcesign commented May 4, 2023

The PR looks fine, and it should work.

The key point seems the namespace or name of karmada-agent in the member cluster.

Does it have a special label? like karmada.io/deployed-by: karmadactl?
If it hasn't, can we add it with karmadactl?

@lonelyCZ
Copy link
Member

lonelyCZ commented May 4, 2023

Does it have a special label? like karmada.io/deployed-by: karmadactl?

It is a good idea. Does we still need to specify the namespace of karmada-agent?

@jwcesign
Copy link
Member

jwcesign commented May 4, 2023

Does we still need to specify the namespace of karmada-agent?

I think yes.

@RainbowMango
Copy link
Member

The pull mode cluster shall be unregistered by karmadactl unregister, not karmada unjoin. The karmadactl unregister was introduced in the v1.12 release.

cc @zhzhuang-zju Shall we add some validations to karmada unjoin to avoid trying to remove the pull mode cluster?

@zhzhuang-zju
Copy link
Contributor

Shall we add some validations to karmada unjoin to avoid trying to remove the pull mode cluster?

To prevent user errors, it is beneficial to add validations and provide clear descriptions to guide user actions. Likewise, the command karmadactl unregister could also incorporate similar validations.

@zhzhuang-zju
Copy link
Contributor

/assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
5 participants