Skip to content

Add bootstrap from capi #482

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions content/en/docs/getting-started/installation/register-a-cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,59 @@ cluster.
{{% /tab %}}
{{< /tabpane >}}

### Bootstrap a cluster provisioned by Cluster-API
Copy link
Member

@mikeshng mikeshng Jun 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The header is kind of confusing. This new section covers auto-register(?) which doesn't require any manual bootstrapping of the klusterlet. Maybe we should be moving the new content to a dedicated "Auto register" header instead.

Does this auto register still need clusteradm to run accept? If it doesn't, maybe move the new header to above "Install clusteradm CLI tool". If it does require clusteradm, then move the new header below "Install clusteradm CLI tool" but above "Bootstrap a klusterlet".

I am thinking the new header should be Auto-register a cluster provisioned by Cluster API then the rest of your content follows (which looks fine to me). Thanks.


If cluster-api provider is installed on the hub cluster, and the cluster can be provisioned
via cluster-api on the hub cluster, users can bootstrap a cluster on the hub directly. There
are some pre-requisites to satisfy
1. The cluster-api provider is deployed on the hub cluster using `clusterctl init ...`
2. The hub cluster is able to access the apiserver of cluster provisioned by cluster-api.
3. ClusterImporter feature gate is enabled on the ClusterManager as below:
```yaml
apiVersion: operator.open-cluster-management.io/v1
kind: ClusterManager
metadata:
name: cluster-manager
spec:
registrationConfiguration:
featureGates:
- feature: ClusterImporter
mode: Enable
```
4. The registration controller should bind to the same permission of the cluster-api provider
to be able to get the secret that stored kubeconfig to access the provisioned cluster.
```yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: cluster-manager-registration-capi
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: capi-manager-role # this name could be different for different capi provider
subjects:
- kind: ServiceAccount
name: registration-controller-sa
namespace: open-cluster-management-hub
```
5. Ensure the existence of cluster-info configmap in the kube-public namespace.

After all the above setting is done, you can now start a capi-cluster and import it from
the hub cluster.
1. follow the [instruction](https://cluster-api.sigs.k8s.io/user/quick-start) to provision
a cluster with command:
```shell
clusterctl generate cluster capi-cluster --namespace capi-cluster --kubernetes-version [version] | kubectl apply -f -
```
2. create a managedcluster on the hub
```yaml
apiVersion: cluster.open-cluster-management.io/v1
kind: ManagedCluster
metadata:
name: capi-cluster
spec: {}
```

## Accept the join request and verify

After the OCM agent is running on your managed cluster, it will be sending a "handshake" to your
Expand Down