Skip to content

Commit 18d4c65

Browse files
committed
Add bootstrap from capi
Signed-off-by: Jian Qiu <jqiu@redhat.com>
1 parent 942eb6f commit 18d4c65

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

content/en/docs/getting-started/installation/register-a-cluster.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,59 @@ cluster.
163163
{{% /tab %}}
164164
{{< /tabpane >}}
165165

166+
### Bootstrap a cluster provisioned by Cluster-API
167+
168+
If cluster-api provider is installed on the hub cluster, and the cluster can be provisioned
169+
via cluster-api on the hub cluster, users can bootstrap a cluster on the hub directly. There
170+
are some pre-requisites to satisfy
171+
1. The cluster-api provider is deployed on the hub cluster using `clusterctl init ...`
172+
2. The hub cluster is able to access the apiserver of cluster provisioned by cluster-api.
173+
3. ClusterImporter feature gate is enabled on the ClusterManager as below:
174+
```yaml
175+
apiVersion: operator.open-cluster-management.io/v1
176+
kind: ClusterManager
177+
metadata:
178+
name: cluster-manager
179+
spec:
180+
registrationConfiguration:
181+
featureGates:
182+
- feature: ClusterImporter
183+
mode: Enable
184+
```
185+
4. The registration controller should bind to the same permission of the cluster-api provider
186+
to be able to get the secret that stored kubeconfig to access the provisioned cluster.
187+
```yaml
188+
apiVersion: rbac.authorization.k8s.io/v1
189+
kind: ClusterRoleBinding
190+
metadata:
191+
name: cluster-manager-registration-capi
192+
roleRef:
193+
apiGroup: rbac.authorization.k8s.io
194+
kind: ClusterRole
195+
name: capi-manager-role # this name could be different for different capi provider
196+
subjects:
197+
- kind: ServiceAccount
198+
name: registration-controller-sa
199+
namespace: open-cluster-management-hub
200+
```
201+
5. Ensure the existence of cluster-info configmap in the kube-public namespace.
202+
203+
After all the above setting is done, you can now start a capi-cluster and import it from
204+
the hub cluster.
205+
1. follow the [instruction](https://cluster-api.sigs.k8s.io/user/quick-start) to provision
206+
a cluster with command:
207+
```shell
208+
clusterctl generate cluster capi-cluster --namespace capi-cluster --kubernetes-version [version] | kubectl apply -f -
209+
```
210+
2. create a managedcluster on the hub
211+
```yaml
212+
apiVersion: cluster.open-cluster-management.io/v1
213+
kind: ManagedCluster
214+
metadata:
215+
name: capi-cluster
216+
spec: {}
217+
```
218+
166219
## Accept the join request and verify
167220
168221
After the OCM agent is running on your managed cluster, it will be sending a "handshake" to your

0 commit comments

Comments
 (0)