open-cluster-management-io / ocm

Core components in the OCM project. Report here if you found any issues in OCM.
https://open-cluster-management.io
Apache License 2.0
739 stars 92 forks source link

Feature Request: Cluster API integration - automatic installation of klusterlet on managed clusters #47

Open grzesuav opened 2 years ago

grzesuav commented 2 years ago

Proposal

Currently you can use ClusterAPI to spin up new kubernetes clusters. It has different provider implementations, however. most of them (I didn't checked all) provides CA secrets to access managed cluster. Having this, and having OCM in admin/hub cluster, it would be useful to automatically install klusterjet agent of any new cluster and join them to the hub.

qiujian16 commented 2 years ago

/kind feature

Thanks, I think it is a great idea. Do you expect that this will be implemented in clusteradm?

grzesuav commented 2 years ago

Actually no, it must be implemented in some watcher/controller in the hub cluster to dynamically watch which clusters are being created by ClusterAPI and take appropriate action

grzesuav commented 2 years ago

Looking at https://github.com/open-cluster-management-io/registration-operator I think it should be a companion operator for them, like setting up klusterjet parton remote cluster and provide bootstrapping token

qiujian16 commented 2 years ago

Yes, I think it is possible.

yandooo commented 2 years ago

what would be steps/code to register managed cluster assuming we have user kubeconfig from Cluster API?

berenss commented 2 years ago

I think you want to look at registration controller: https://open-cluster-management.io/getting-started/core/register-cluster/#prerequisite

mikeshng commented 2 years ago

what would be steps/code to register managed cluster assuming we have user kubeconfig from Cluster API?

You can use the link Scott provided above. In summary:

If you are using our clusteradm tool and you have ran the clusteradm init command on the "hub" cluster and have the token output for managed cluster registration. You can then use clusteradm join --kubeconfig /path/to/managed_cluster_kubeconfig --hub-token <token_here> --hub-apiserver <https://apiserver_here> --cluster-name <cluster_name_of_your_choice> --wait

If you don't want to use clusteradm cli tool. You can refer to https://github.com/open-cluster-management-io/registration-operator#deploy-hub-spoke-deployment In short it will,

yandooo commented 2 years ago

clusteradm looks easier initial approach. Thanks

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 120 days with no activity. After 14 days of inactivity, it will be closed. Remove the stable label to prevent this issue from being closed.

github-actions[bot] commented 10 months ago

This issue is stale because it has been open for 120 days with no activity. After 14 days of inactivity, it will be closed. Remove the stable label to prevent this issue from being closed.

qiujian16 commented 10 months ago

/assign

I will do some investigation on this.

qiujian16 commented 9 months ago

We have a discussion on the last community meeting. There are some good points:

  1. It will be more useful if the cluster provisioned by capi can be automatically imported into ocm hub.
  2. capi management cluster does not necessarily to be the ocm hub.
  3. It should be possible to run capi management cluster as a managed cluster of ocm, we could have an addon installed on capi management cluster to do automatic cluster import.
qiujian16 commented 6 months ago

will do a demo in the following community meeting after 0.13.0 release

qiujian16 commented 3 months ago

https://github.com/open-cluster-management-io/clusteradm/pull/428