1+ # Steps to build draincluster as a kubectl plugin
2+
3+ 1 . Build the binary for the ` uncordoncluster ` tool by running the following command in the root directory of the fleet repo:
4+
5+ ``` bash
6+ go build -o ./hack/tools/bin/kubectl-uncordoncluster ./tools/uncordoncluster/main.go
7+ ```
8+
9+ 2 . Move the binary to a directory in your ` PATH ` so that it can be run as a kubectl plugin. For example, you can move it to
10+ ` /usr/local/bin ` :
11+
12+ ``` bash
13+ sudo cp ./hack/tools/bin/kubectl-uncordoncluster /usr/local/bin/
14+ ```
15+
16+ 3 . Make the binary executable by running the following command:
17+
18+ ``` bash
19+ chmod +x /usr/local/bin/kubectl-uncordoncluster
20+ ```
21+
22+ 4 . Verify that the plugin is recognized by kubectl by running the following command:
23+
24+ ``` bash
25+ kubectl plugin list
26+ ```
27+
28+ you should see the ` uncordoncluster ` plugin listed in the output:
29+
30+ ```
31+ The following compatible plugins are available:
32+
33+ /usr/local/bin/kubectl-uncordoncluster
34+ ```
35+
36+ please refer to the [ kubectl plugin documentation] ( https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/ ) for
37+ more information.
38+
39+
140# Uncordon Member Cluster connected to a fleet
241
3- To uncordon a member cluster connected to a fleet, you can use the ` uncordoncluster ` tool. This tool allows you to
4- uncordon a member cluster that has been cordoned using the ` draincluster ` tool.
42+ After following the steps above to build the ` uncordoncluster ` tool as a kubectl plugin, you can use it to uncordon a
43+ member cluster that has been cordoned using the ` draincluster ` tool.
544
645```
7- go run tools/ uncordoncluster/main.go --hubClusterContext <hub-cluster-context> --clusterName <memberClusterName>
46+ kubectl uncordoncluster --hubClusterContext <hub-cluster-context> --clusterName <memberClusterName>
847```
948
1049the tool currently is a go program that also takes the hub cluster context and the member cluster name as arguments.
@@ -25,5 +64,9 @@ CURRENT NAME CLUSTER AUTHINFO
2564* hub hub clusterUser_clusterResourceGroup_hub
2665```
2766
28- The command removes all taints added to a ` MemberCluster ` resource and hence if any ` ClusterResourcePlacementEviction `
29- object present which can propagate resources to the member cluster, it can continue to do so.
67+ Here you can see that the context of the hub cluster is called ` hub ` under the ` NAME ` column.
68+
69+ The command removes the ` cordon ` taint added to a ` MemberCluster ` resource by the ` draincluster ` tool. If the ` cordon `
70+ taint is not present, the command will not have any effect. Once the taint is removed if there are no other taints on the
71+ ` MemberCluster ` resource, the member cluster will be uncordoned and resource can be propagated to it from the hub cluster
72+ using ` Placement ` resources.
0 commit comments