Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.

Commit 8007260

Browse files
author
Gianluca Arbezzano
committed
docs to explain how the cluster-template can be edited
The workflow explained by cluster-api documentation and in our readme is the basic one. But you do not need to use the `clusterctl config cluster` command to get cluster spec you need to create your workload. You can write your own one or you can start from the template and modify it based on your need.
1 parent 620918f commit 8007260

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ This will:
9292
1. Generate the output
9393
1. Tell you where it is an the `kubectl apply` command to run
9494

95+
If you want to use your own cluster template or modify the default one
96+
extensively, [this document](./docs/experiences/custom-cluster-template.md)
97+
describes how to do so.
98+
9599
##### Defaults
96100

97101
If you do not change the generated `yaml` files, it will use defaults. You can look in the [templates/cluster-template.yaml](./templates/cluster.yaml) file for details.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
When using the `clusterctl` you can generate your own cluster spec from a
2+
template.
3+
4+
This is what happens when you run:
5+
6+
```sh
7+
$ clusterctl config cluster <cluster-name> --infrastructure packet >
8+
out/cluster.yaml
9+
```
10+
11+
The workflow triggered by that command summarized here:
12+
13+
1. Based on the `--infrastructure` option it goes to the right repository and it
14+
looks for the `latest` release. At the time I am writing it is
15+
[v0.3.0](gh-release-v030).
16+
2. `clusterctl` lookup a file called `cluster-template.yaml` from the release artifacts
17+
3. `clusterctl` uses `cluster-template.yaml` plus a set of environment variables
18+
that you can find described in the README.md to generate the cluster
19+
specification
20+
4. With the command `> out/cluster.yaml` the generated spec gets moved to
21+
`./out/cluster.yaml` other than being printed to `stdout`.
22+
23+
This is good if you do not have particular needs or if you are trying capp.
24+
25+
The current `cluster-templates.yaml` uses `apt` and it depends upon `Ubuntu`.
26+
But you can open and modify it to match your requirements.
27+
28+
## When should I modify the template?
29+
30+
Every time you feel like the default one is not enough, or if you need more
31+
automation. Here a few examples:
32+
33+
1. ClusterAPI decided to leave the CNI configuration out from its workflow
34+
because there are too many of them. If you want to automate that part and
35+
let's suppose you want `flannel` you can add the following line to
36+
`postKubeadmCommands` for the `KubeadmControlPlane` resource:
37+
38+
```sh
39+
kubectl --kubeconfig /etc/kubernetes/admin.conf apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
40+
```
41+
42+
2. If you want to use an operating system that is not Ubuntu you can change the
43+
`preKubeadmCommands` for the `KubeadmControlPlane` and the
44+
`KubeadmConfigTemplate` to use kubernetes binaries or a different package
45+
manager.
46+
47+
3. (2a) If you want to change operating system you have to change the `OS` field
48+
for the `PacketMachineTemplate` resource
49+
50+
51+
[gh-release-v030]: https://github.com/kubernetes-sigs/cluster-api-provider-packet/releases/tag/v0.3.0

0 commit comments

Comments
 (0)