-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
doc: add capi how-to for custom bootstrap config (#1122)
We're adding a how-to document, showing how to use a custom bootstrap configuration with the Cluster API provider. Note that this is already outlined by the config reference page: https://documentation.ubuntu.com/canonical-kubernetes/latest/capi/reference/configs/#bootstrapconfig
- Loading branch information
1 parent
7c4bf07
commit 9ef10c5
Showing
2 changed files
with
108 additions
and
0 deletions.
There are no files selected for viewing
107 changes: 107 additions & 0 deletions
107
docs/canonicalk8s/capi/howto/custom-bootstrap-config.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
# How to use custom bootstrap configuration | ||
|
||
The {{product}} bootstrap configuration gets automatically generated based on | ||
user provided settings described in the [Cluster API configuration reference]. | ||
|
||
The configuration generated by the CAPI provider will also include CA | ||
certificates as well as annotations and other settings that allow the provider | ||
to function properly. | ||
|
||
Not all bootstrap options are exposed through CAPI settings. However, | ||
users can explicitly define the {{product}} bootstrap configuration. | ||
This completely bypasses the other CAPI provider settings and the configuration | ||
will be passed as-is to the {{product}} snap. | ||
|
||
See the [Bootstrap configuration file reference] for more details about the | ||
available settings. | ||
|
||
## Passing the bootstrap configuration directly | ||
|
||
The bootstrap configuration can be specified in the ``CK8sControlPlane`` spec: | ||
|
||
``` | ||
apiVersion: controlplane.cluster.x-k8s.io/v1beta2 | ||
kind: CK8sControlPlane | ||
metadata: | ||
name: c1-control-plane | ||
namespace: default | ||
spec: | ||
machineTemplate: | ||
infrastructureTemplate: | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 | ||
kind: DockerMachineTemplate | ||
name: c1-control-plane | ||
replicas: 1 | ||
spec: | ||
bootstrapConfig: | ||
content: | | ||
cluster-config: | ||
annotations: | ||
k8sd/v1alpha/lifecycle/skip-cleanup-kubernetes-node-on-remove: "true" | ||
k8sd/v1alpha/lifecycle/skip-stop-services-on-remove: "true" | ||
network: | ||
enabled: true | ||
dns: | ||
enabled: true | ||
local-storage: | ||
enabled: true | ||
reclaim-policy: Retain | ||
``` | ||
|
||
Note that the k8sd annotations allow the CAPI provider to properly remove | ||
nodes. | ||
|
||
## Using secrets to store the bootstrap configuration | ||
|
||
The bootstrap configuration may contain sensitive data. For this reason, the | ||
provider also allows passing it as a secret. | ||
|
||
``` | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: ck8s-bootstrap-config | ||
type: Opaque | ||
stringData: | ||
content: | | ||
cluster-config: | ||
annotations: | ||
k8sd/v1alpha/lifecycle/skip-cleanup-kubernetes-node-on-remove: "true" | ||
k8sd/v1alpha/lifecycle/skip-stop-services-on-remove: "true" | ||
network: | ||
enabled: true | ||
dns: | ||
enabled: true | ||
local-storage: | ||
enabled: true | ||
reclaim-policy: Retain | ||
``` | ||
|
||
The secret can then be referenced like so: | ||
|
||
``` | ||
apiVersion: controlplane.cluster.x-k8s.io/v1beta2 | ||
kind: CK8sControlPlane | ||
metadata: | ||
name: c1-control-plane | ||
namespace: default | ||
spec: | ||
machineTemplate: | ||
infrastructureTemplate: | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 | ||
kind: DockerMachineTemplate | ||
name: c1-control-plane | ||
replicas: 1 | ||
spec: | ||
bootstrapConfig: | ||
contentFrom: | ||
secret: | ||
# Name of the secret in the CK8sBootstrapConfig's namespace to use. | ||
name: ck8s-bootstrap-config | ||
# The key in the secret's data map for this value. | ||
key: content | ||
``` | ||
|
||
<!-- LINKS --> | ||
[Cluster API configuration reference]: /capi/reference/configs.md | ||
[Bootstrap configuration file reference]: /snap/reference/config-files/bootstrap-config.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters