{"id":18754732,"url":"https://github.com/oam-dev/cluster-register","last_synced_at":"2025-07-22T22:36:51.710Z","repository":{"id":42976592,"uuid":"385530483","full_name":"oam-dev/cluster-register","owner":"oam-dev","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-17T10:30:36.000Z","size":87,"stargazers_count":5,"open_issues_count":0,"forks_count":9,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-06-17T11:39:15.165Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oam-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-13T08:21:09.000Z","updated_at":"2025-06-17T10:30:40.000Z","dependencies_parsed_at":"2024-11-07T17:49:54.559Z","dependency_job_id":null,"html_url":"https://github.com/oam-dev/cluster-register","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/oam-dev/cluster-register","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oam-dev%2Fcluster-register","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oam-dev%2Fcluster-register/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oam-dev%2Fcluster-register/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oam-dev%2Fcluster-register/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oam-dev","download_url":"https://codeload.github.com/oam-dev/cluster-register/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oam-dev%2Fcluster-register/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266586519,"owners_count":23952172,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T17:29:50.980Z","updated_at":"2025-07-22T22:36:51.679Z","avatar_url":"https://github.com/oam-dev.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cluster-register\n\ncluster-register can help KubeVela users to register a new cluster in a multi-cluster environment. \n\n## Prerequisite\n\n1. Prepare one Kubernetes cluster to function as the hub and one Kubernetes cluster as spoke cluster.\nFor example, use `kind` to create hub cluster and spoke cluster. To use `kind`, you will need `docker` installed and running.\n\n```shell\nkind create cluster --name hub\nkind create cluster --name cluster1\n```\n\n2. Install KubeVela in hub cluster\n\n```shell\nkubectl config use-context kind-hub\nhelm install --create-namespace -n vela-system kubevela kubevela/vela-core\n```\n\n## Usage\n\ncluster-register supports registering Managed Cluster by OCM.\n\n1. Use Initializer `ocm-cluster-manager` to create a Hub Cluster environment.\n\n```shell\n# change to hub cluster\nkubectl config use-context kind-hub\n```\n\n```shell\nkubectl apply -f https://raw.githubusercontent.com/oam-dev/kubevela/master/vela-templates/addons/auto-gen/ocm-cluster-manager.yaml\n```\n\n2. Export the kubeconfig of the Managed Cluster and store it in the Secret of the Hub Cluster\n\n```shell\n# 1. export cluster1 kubeconfig to .cluster1-kubeconfig\nkind get kubeconfig --name cluster1  --internal \u003e .cluster1-kubeconfig\n# 2. store kubeconfig in secret of hub-cluster\nkubectl create secret generic spoke-kubeconfig --from-file=kubeconfig=.cluster1-kubeconfig --from-literal=name=kind-cluster1\n```\n\ncluster-register also supports combine the kubeconfig of the spoke cluster with the certificate and key provided by the user.\nSo the Secret should provide the necessary values like the following example:\n\n```yaml\napiVersion: v1\ndata:\n  # api_server_internet maps to clusters[0].cluster.server in kubeconfig, represent to the apiserver of spoke cluster\n  api_server_internet: XXXXX\n  # client_cert maps to users[0].user.client-certificate-data\n  client_cert: XXXXX\n  # client_key maps to users[0].user.client-key-data\n  client_key: XXXXX\n  # cluster_ca_cert maps to clusters[0].cluster.certificate-authority-data\n  cluster_ca_cert: XXXXX\n  # You can also choose to provide a kubeconfig file, cluster-register will give priority to the user-provided kubeconfig\n  kubeconfig: XXXXX\n  name: kind-cluster1\nkind: Secret\nmetadata:\n  name: spoke-kubeconfig\ntype: Opaque\n```\n\n3. Create the cluster-register Job\n\n```shell\nkubectl apply -f manifest\n```\n\nif hub cluster and spoke cluster are not in the same VPC, you should provide the external address of the hub cluster.\n\n```yaml\napiVersion: core.oam.dev/v1beta1\nkind: Application\nmetadata:\n  name: cluster-register\n  namespace: default\nspec:\n  components:\n    - name: register\n      type: cluster-register\n      properties:\n        clusterSecret: spoke-kubeconfig\n        hubAPIServer: \"apiserver address\"\n```\n4. Wait for the Managed Cluster is available\n\n```shell\n$ kubectl get managedclusters.cluster.open-cluster-management.io --watch\nNAME            HUB ACCEPTED   MANAGED CLUSTER URLS             JOINED   AVAILABLE   AGE\nkind-cluster1   true           https://hub-control-plane:6443   True     True        78m\n```\n\n5. Delete the Secret\n\n```shell\nkubectl delete secret spoke-kubeconfig\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foam-dev%2Fcluster-register","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foam-dev%2Fcluster-register","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foam-dev%2Fcluster-register/lists"}