|
1 | 1 | # cluster-api-bootstrap-provider-talos
|
2 | 2 |
|
3 |
| -A [cluster-api](https://github.com/kubernetes-sigs/cluster-api) bootstrap provider for deploying [Talos](https://github.com/talos-systems/talos) clusters. |
| 3 | +## Intro |
4 | 4 |
|
| 5 | +The Cluster API Bootstrap Provider Talos (CABPT) is a project by [Talos Systems](https://www.talos-systems.com/) that provides a [Cluster API](https://github.com/kubernetes-sigs/cluster-api)(CAPI) bootstrap provider for use in deploying Talos-based Kubernetes nodes across any environment. |
| 6 | +Given some basic info, this provider will generate bootstrap configurations for a given machine and reconcile the necessary custom resources for CAPI to pick up the generated data. |
5 | 7 |
|
6 |
| -#### Getting Started Guides: |
| 8 | +## Corequisites |
7 | 9 |
|
8 |
| -- [GCP](docs/GCP.md) |
| 10 | +There are a few corequisites and assumptions that go into using this project: |
| 11 | + |
| 12 | +- [Cluster API](https://github.com/kubernetes-sigs/cluster-api) |
| 13 | +- [Cluster API Provider Metal](https://github.com/talos-systems/cluster-api-provider-metal) (optional) |
| 14 | + |
| 15 | +## Building and Installing |
| 16 | + |
| 17 | +This project can be built simply by running `make release` from the root directory. |
| 18 | +Doing so will create a file called `_out/release.yaml`. |
| 19 | +If you wish, you can tweak settings by editing the release yaml. |
| 20 | +This file can then be installed into your management cluster with `kubectl apply -f _out/release.yaml`. |
| 21 | + |
| 22 | +Note that CABPT should be deployed as part of a set of controllers for Cluster API. |
| 23 | +You will need at least the upstream CAPI components and an infrastructure provider for v1alpha2 CAPI capabilities. |
| 24 | + |
| 25 | +## Usage |
| 26 | + |
| 27 | +CAPM supports a single API type, a TalosConfig. |
| 28 | +You can create YAML definitions of a TalosConfig and `kubectl apply` them as part of a larger CAPI cluster deployment. |
| 29 | +Below is a bare-minimum example. |
| 30 | + |
| 31 | +A basic config: |
| 32 | + |
| 33 | +```yaml |
| 34 | +apiVersion: bootstrap.cluster.x-k8s.io/v1alpha2 |
| 35 | +kind: TalosConfig |
| 36 | +metadata: |
| 37 | + name: talos-0 |
| 38 | + labels: |
| 39 | + cluster.x-k8s.io/cluster-name: talos |
| 40 | +spec: |
| 41 | + generateType: init |
| 42 | +``` |
| 43 | +
|
| 44 | +Note the generateType mentioned above. |
| 45 | +This is a required value in the spec for a TalosConfig. |
| 46 | +For a no-frills bootstrap config, you can simply specify `init`, `controlplane`, or `worker` depending on what type of Talos node this is. |
| 47 | +When creating a TalosConfig this way, you can then retrieve the talosconfig file that allows for osctl interaction with your nodes by doing something like `kubectl get talosconfig -o yaml talos-0 -o jsonpath='{.status.talosConfig}'` after creation. |
| 48 | + |
| 49 | +If you wish to do something more complex, we allow for the ability to supply an entire Talos config file to the resource. |
| 50 | +This can be done by setting the generateType to `none` and specifying a `data` field. |
| 51 | +This config file can be generated with `osctl config generate` and the edited to supply the various options you may desire. |
| 52 | +This full config is blindly copied from the `data` section of the spec and presented under `.status.bootstrapData` so that the upstream CAPI controllers can see it and make use. |
| 53 | + |
| 54 | +An example of a more complex config: |
| 55 | + |
| 56 | +```yaml |
| 57 | +apiVersion: bootstrap.cluster.x-k8s.io/v1alpha2 |
| 58 | +kind: TalosConfig |
| 59 | +metadata: |
| 60 | + name: talos-0 |
| 61 | + labels: |
| 62 | + cluster.x-k8s.io/cluster-name: talos |
| 63 | +spec: |
| 64 | + generateType: none |
| 65 | + data: | |
| 66 | + version: v1alpha1 |
| 67 | + machine: |
| 68 | + type: init |
| 69 | + token: xxxxxx |
| 70 | + ... |
| 71 | + ... |
| 72 | + ... |
| 73 | +``` |
| 74 | + |
| 75 | +Note that specifying the full config above removes the ability for our bootstrap provider to generate a talosconfig for use. |
| 76 | +As such, you should keep track of the talosconfig that's generated when running `osctl config generate`. |
0 commit comments