@@ -186,3 +186,130 @@ Users can just run kubectl apply -f <URL for YAML BUNDLE> to install the project
186
186
``` sh
187
187
kubectl apply -f https://raw.githubusercontent.com/< org> /cluster-api-provider-metal-stack/< tag or branch> /dist/install.yaml
188
188
```
189
+
190
+ ## Quick opinionated Cluster Bootstrap and move
191
+
192
+ This is a short and opinionated fast track to create and move a cluster using our provider.
193
+ In contrast to a guide and the README, we do not explain all commands and try to be concise.
194
+
195
+ Configure your clusterctl:
196
+
197
+ ``` yaml
198
+ # ~/.config/cluster-api/clusterctl.yaml
199
+ providers :
200
+ - name : " metal-stack"
201
+ url : " https://github.com/metal-stack/cluster-api-provider-metal-stack/releases/latest/download/infrastructure-components.yaml"
202
+ # or for PRs
203
+ # url: "${HOME}/path/to/infrastructure-metal-stack/v0.4.0/infrastructure-components.yaml"
204
+ # generate with:
205
+ # IMG_TAG=branch-name RELEASE_DIR=${HOME}/path/to/infrastructure-metal-stack/v0.4.0 make release-manifests
206
+ type : InfrastructureProvider
207
+ ` ` `
208
+
209
+ Set environment variables. Don't forget to update them along the way.
210
+
211
+ ` ` ` bash
212
+ export EXP_KUBEADM_BOOTSTRAP_FORMAT_IGNITION=true
213
+
214
+ export METAL_API_HMAC=
215
+ export METAL_API_HMAC_AUTH_TYPE=
216
+ export METAL_API_URL=
217
+
218
+ export METAL_PARTITION=
219
+ export METAL_PROJECT_ID=
220
+ export METAL_NODE_NETWORK_ID=
221
+
222
+ export FIREWALL_MACHINE_IMAGE=
223
+ export FIREWALL_MACHINE_SIZE=
224
+
225
+ export CONTROL_PLANE_MACHINE_IMAGE=
226
+ export CONTROL_PLANE_MACHINE_SIZE=
227
+ export WORKER_MACHINE_IMAGE=
228
+ export WORKER_MACHINE_SIZE=
229
+
230
+ export CLUSTER_NAME=
231
+ export NAMESPACE=default
232
+ export KUBERNETES_VERSION=v1.30.6
233
+
234
+ export CONTROL_PLANE_MACHINE_COUNT=1
235
+ export WORKER_MACHINE_COUNT=1
236
+
237
+ # Additional envs
238
+ export repo_path=$HOME/path/to/cluster-api-provider-metal-stack
239
+ export project_name=
240
+ export tenant_name=
241
+ export firewall_id=
242
+ ```
243
+
244
+ Create firewall if needed:
245
+
246
+ ``` bash
247
+ metalctl project create --name $project_name --tenant $tenant_name --description " Cluster API test project"
248
+ metalctl network allocate --description " Node network for $CLUSTER_NAME " --name $CLUSTER_NAME --project $METAL_PROJECT_ID --partition $METAL_PARTITION
249
+ metalctl firewall create --description " Firewall for $CLUSTER_NAME cluster" --name firewall-$CLUSTER_NAME --hostname firewall-$CLUSTER_NAME --project $METAL_PROJECT_ID --partition $METAL_PARTITION --image $FIREWALL_MACHINE_IMAGE --size $FIREWALL_MACHINE_SIZE --firewall-rules-file $repo_path /config/target-cluster/firewall-rules.yaml --networks internet,$METAL_NODE_NETWORK_ID
250
+ ```
251
+
252
+ ``` bash
253
+ kind create cluster --name bootstrap
254
+ kind export kubeconfig --name bootstrap --kubeconfig kind-bootstrap.kubeconfig
255
+
256
+ clusterctl init --infrastructure metal-stack --kubeconfig kind-bootstrap.kubeconfig
257
+ clusterctl generate cluster $CLUSTER_NAME --infrastructure metal-stack > cluster-$CLUSTER_NAME .yaml
258
+ kubectl apply -n $NAMESPACE -f cluster-$CLUSTER_NAME .yaml
259
+
260
+ # once the control plane node is in phoned home
261
+ metalctl machine consolepassword $firewall_id
262
+ metalctl machine console --ipmi $firewall_id
263
+ # sudo systemctl restart frr
264
+ # ~.
265
+
266
+ kubectl --kubeconfig kind-bootstrap.kubeconfig -n $NAMESPACE get metalstackmachines.infrastructure.cluster.x-k8s.io
267
+ export control_plane_machine_id=
268
+ metalctl machine console --ipmi $control_plane_machine_id
269
+ # ip r
270
+ # sudo systemctl restart kubeadm
271
+ # crictl ps
272
+ # ~.
273
+
274
+ clusterctl get kubeconfig > capms-cluster.kubeconfig
275
+
276
+ # metal-ccm
277
+ cat $repo_path /config/target-cluster/metal-ccm.yaml | envsubst | kubectl --kubeconfig capms-cluster.kubeconfig apply -f -
278
+
279
+ # cni
280
+ kubectl --kubeconfig=capms-cluster.kubeconfig create -f https://raw.githubusercontent.com/projectcalico/calico/v3.28.2/manifests/tigera-operator.yaml
281
+ cat << EOF | kubectl --kubeconfig=capms-cluster.kubeconfig create -f -
282
+ apiVersion: operator.tigera.io/v1
283
+ kind: Installation
284
+ metadata:
285
+ name: default
286
+ spec:
287
+ # Configures Calico networking.
288
+ calicoNetwork:
289
+ bgp: Disabled
290
+ ipPools:
291
+ - name: default-ipv4-ippool
292
+ blockSize: 26
293
+ cidr: 10.240.0.0/12
294
+ encapsulation: None
295
+ mtu: 1440
296
+ cni:
297
+ ipam:
298
+ type: HostLocal
299
+ type: Calico
300
+ EOF
301
+
302
+ watch kubectl -n $NAMESPACE --kubeconfig kind-bootstrap.kubeconfig get cluster,metalstackcluster,machine,metalstackmachine,kubeadmcontrolplanes,kubeadmconfigs
303
+ # until everything is ready
304
+ ```
305
+
306
+ Now you are able to move the cluster resources as you wish:
307
+
308
+ ``` bash
309
+ clusterctl init --infrastructure metal-stack --kubeconfig capms-cluster.kubeconfig
310
+
311
+ clusterctl move -n $NAMESPACE --kubeconfig kind-bootstrap.kubeconfig --to-kubeconfig capms-cluster.kubeconfig
312
+ # everything as expected
313
+ kubectl --kubeconfig -n $NAMESPACE kind-bootstrap.kubeconfig get cluster,metalstackcluster,machine,metalstackmachine,kubeadmcontrolplanes,kubeadmconfigs
314
+ kubectl --kubeconfig -n $NAMESPACE capms-cluster.kubeconfig get cluster,metalstackcluster,machine,metalstackmachine,kubeadmcontrolplanes,kubeadmconfigs
315
+ ```
0 commit comments