Skip to content

Latest commit

 

History

History
51 lines (37 loc) · 2.07 KB

custom-cluster-template.md

File metadata and controls

51 lines (37 loc) · 2.07 KB

When using the clusterctl you can generate your own cluster spec from a template.

This is what happens when you run:

$ clusterctl config cluster <cluster-name> --infrastructure packet >
out/cluster.yaml

The workflow triggered by that command summarized here:

  1. Based on the --infrastructure option it goes to the right repository and it looks for the latest release. At the time I am writing it is v0.3.0.
  2. clusterctl lookup a file called cluster-template.yaml from the release artifacts
  3. clusterctl uses cluster-template.yaml plus a set of environment variables that you can find described in the README.md to generate the cluster specification
  4. With the command > out/cluster.yaml the generated spec gets moved to ./out/cluster.yaml other than being printed to stdout.

This is good if you do not have particular needs or if you are trying capp.

The current cluster-templates.yaml uses apt and it depends upon Ubuntu. But you can open and modify it to match your requirements.

When should I modify the template?

Every time you feel like the default one is not enough, or if you need more automation. Here a few examples:

  1. ClusterAPI decided to leave the CNI configuration out from its workflow because there are too many of them. If you want to automate that part and let's suppose you want flannel you can add the following line to postKubeadmCommands for the KubeadmControlPlane resource:
kubectl --kubeconfig /etc/kubernetes/admin.conf apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
  1. If you want to use an operating system that is not Ubuntu you can change the preKubeadmCommands for the KubeadmControlPlane and the KubeadmConfigTemplate to use kubernetes binaries or a different package manager.

  2. (2a) If you want to change operating system you have to change the OS field for the PacketMachineTemplate resource