From 46b31110b8c3c53090eaa89eab2cf66cf351f4c9 Mon Sep 17 00:00:00 2001 From: louiseschmidtgen Date: Wed, 8 Jan 2025 15:50:13 +0100 Subject: [PATCH 1/6] custom bootstrap config --- .../src/snap/howto/custom-bootstrap-config.md | 73 +++++++++++++++++++ docs/src/snap/howto/index.md | 1 + 2 files changed, 74 insertions(+) create mode 100644 docs/src/snap/howto/custom-bootstrap-config.md diff --git a/docs/src/snap/howto/custom-bootstrap-config.md b/docs/src/snap/howto/custom-bootstrap-config.md new file mode 100644 index 000000000..12d95d00f --- /dev/null +++ b/docs/src/snap/howto/custom-bootstrap-config.md @@ -0,0 +1,73 @@ +# Custom Bootstrap Configuration + +When creating a {{ product }} cluster that differs from the default +configuration you can choose to use a custom bootstrap configuration. +The CLI's interactive mode or a custom bootstrap config file allow you to +modify the configuration of the first node that will join your cluster. + +## Configuration Options + +Please consult the [bootstrap-configuration-reference page] for all of the +available configuration options and their defaults. These configuration options +may only be adjusted on bootstrap and not after the cluster is bootstrapped. + +## Interactive mode + +The interactive mode allows for the selection of the built-in features, the pod +CIDR and the Service CIDR. + +To bootstrap interactively, run: + +``` +sudo k8s bootstrap --timeout 10m --interactive +``` + +Here is an example custom configuration: + +``` +Which features would you like to enable? (network, dns, gateway, ingress, local-storage, load-balancer) [network, dns, gateway, local-storage]: network,ingress,dns +Please set the Pod CIDR: [10.1.0.0/16]: 10.1.0.0/16,fd01::/108 +Please set the Service CIDR: [10.152.183.0/24]: 10.152.183.0/24,fd98::/108 +``` + +The output for this example would be: + +``` +Bootstrapping the cluster. This may take a few seconds, please wait. +Bootstrapped a new Kubernetes cluster with node address "192.168.3.117:6400". +The node will be 'Ready' to host workloads after the CNI is deployed successfully. +``` + +## Bootstrap Configuration File + +If your deployment requires a more fine tuned configuration, use the bootstrap +configuration file. A good starting point can be the default +[bootstrap-config-full.yaml]. + +For this example, create a custom bootstrap configuration file: + +```yaml +cat < bootstrap.yaml +cluster-config: + network: + enabled: false +EOF +``` + + +Then, apply the bootstrap configuration file: + +``` +sudo k8s bootstrap --timeout 10m --file /path/to/bootstrap.yaml +``` + +To verify any changes to the built-in features run: + +``` +sudo k8s status +``` + + + +[bootstrap-configuration-reference page]: /src/snap/reference/bootstrap-config-reference.md +[bootstrap-config-full.yaml]: https://raw.githubusercontent.com/canonical/k8s-snap/refs/heads/main/src/k8s/cmd/k8s/testdata/bootstrap-config-full.yaml \ No newline at end of file diff --git a/docs/src/snap/howto/index.md b/docs/src/snap/howto/index.md index 92265bd5e..6c5e1db65 100644 --- a/docs/src/snap/howto/index.md +++ b/docs/src/snap/howto/index.md @@ -18,6 +18,7 @@ install/index networking/index storage/index security/index +custom-bootstrap-config Use an external datastore backup-restore refresh-certs From 6d641102fdd18389584cc1244bf54e38442ee5db Mon Sep 17 00:00:00 2001 From: louiseschmidtgen Date: Wed, 8 Jan 2025 15:56:21 +0100 Subject: [PATCH 2/6] nit --- docs/src/snap/howto/custom-bootstrap-config.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/src/snap/howto/custom-bootstrap-config.md b/docs/src/snap/howto/custom-bootstrap-config.md index 12d95d00f..eeb896051 100644 --- a/docs/src/snap/howto/custom-bootstrap-config.md +++ b/docs/src/snap/howto/custom-bootstrap-config.md @@ -2,8 +2,8 @@ When creating a {{ product }} cluster that differs from the default configuration you can choose to use a custom bootstrap configuration. -The CLI's interactive mode or a custom bootstrap config file allow you to -modify the configuration of the first node that will join your cluster. +The CLI's interactive mode or a custom bootstrap configuration file allow you +to modify the configuration of the first node that will join your cluster. ## Configuration Options From f11defdb11733e3d9eeb697b44c2fc15ed2a7033 Mon Sep 17 00:00:00 2001 From: louiseschmidtgen Date: Thu, 9 Jan 2025 10:04:05 +0100 Subject: [PATCH 3/6] comments --- docs/src/snap/howto/index.md | 1 - .../howto/{ => install}/custom-bootstrap-config.md | 10 +++++++--- docs/src/snap/howto/install/index.md | 1 + 3 files changed, 8 insertions(+), 4 deletions(-) rename docs/src/snap/howto/{ => install}/custom-bootstrap-config.md (87%) diff --git a/docs/src/snap/howto/index.md b/docs/src/snap/howto/index.md index 6c5e1db65..92265bd5e 100644 --- a/docs/src/snap/howto/index.md +++ b/docs/src/snap/howto/index.md @@ -18,7 +18,6 @@ install/index networking/index storage/index security/index -custom-bootstrap-config Use an external datastore backup-restore refresh-certs diff --git a/docs/src/snap/howto/custom-bootstrap-config.md b/docs/src/snap/howto/install/custom-bootstrap-config.md similarity index 87% rename from docs/src/snap/howto/custom-bootstrap-config.md rename to docs/src/snap/howto/install/custom-bootstrap-config.md index eeb896051..b1a1ba4d1 100644 --- a/docs/src/snap/howto/custom-bootstrap-config.md +++ b/docs/src/snap/howto/install/custom-bootstrap-config.md @@ -1,4 +1,4 @@ -# Custom Bootstrap Configuration +# Custom bootstrap configuration When creating a {{ product }} cluster that differs from the default configuration you can choose to use a custom bootstrap configuration. @@ -42,9 +42,13 @@ The node will be 'Ready' to host workloads after the CNI is deployed successfull If your deployment requires a more fine tuned configuration, use the bootstrap configuration file. A good starting point can be the default -[bootstrap-config-full.yaml]. +[bootstrap-config-full.yaml]. By default the network, dns and gateway features +are enabled, but the ingress, load-balancer and local-storage features are +disabled. -For this example, create a custom bootstrap configuration file: + +For this example, create a custom bootstrap configuration file that disables +the network feature: ```yaml cat < bootstrap.yaml diff --git a/docs/src/snap/howto/install/index.md b/docs/src/snap/howto/install/index.md index 76e1169c7..2a3ed29d1 100644 --- a/docs/src/snap/howto/install/index.md +++ b/docs/src/snap/howto/install/index.md @@ -13,6 +13,7 @@ the current How-to guides below. :titlesonly: Install from a snap +custom-bootstrap-config multipass Install in LXD Install in air-gapped environments From c9e4a47e9606cffdbaa44fd048d6096411439f9a Mon Sep 17 00:00:00 2001 From: louiseschmidtgen Date: Thu, 9 Jan 2025 10:26:27 +0100 Subject: [PATCH 4/6] review comments --- .../howto/install/custom-bootstrap-config.md | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/docs/src/snap/howto/install/custom-bootstrap-config.md b/docs/src/snap/howto/install/custom-bootstrap-config.md index b1a1ba4d1..1f65e9e8b 100644 --- a/docs/src/snap/howto/install/custom-bootstrap-config.md +++ b/docs/src/snap/howto/install/custom-bootstrap-config.md @@ -5,11 +5,17 @@ configuration you can choose to use a custom bootstrap configuration. The CLI's interactive mode or a custom bootstrap configuration file allow you to modify the configuration of the first node that will join your cluster. -## Configuration Options +## Configuration options -Please consult the [bootstrap-configuration-reference page] for all of the -available configuration options and their defaults. These configuration options -may only be adjusted on bootstrap and not after the cluster is bootstrapped. +Please consult the [reference page] for all of the +available configuration options and their defaults. + +``` {note} +Most of these configuration options are set during the initial bootstrapping +and cannot be modified afterward. Runtime changes may be unsupported and +could require deploying a new cluster. Refer to the reference page to +determine if an option allows later modifications. +``` ## Interactive mode @@ -30,19 +36,18 @@ Please set the Pod CIDR: [10.1.0.0/16]: 10.1.0.0/16,fd01::/108 Please set the Service CIDR: [10.152.183.0/24]: 10.152.183.0/24,fd98::/108 ``` -The output for this example would be: +The expected output shows your node's ip that will differ from this example: ``` Bootstrapping the cluster. This may take a few seconds, please wait. -Bootstrapped a new Kubernetes cluster with node address "192.168.3.117:6400". +Bootstrapped a new Kubernetes cluster with node address "192.122.3.111:6400". The node will be 'Ready' to host workloads after the CNI is deployed successfully. ``` -## Bootstrap Configuration File +## Bootstrap configuration file -If your deployment requires a more fine tuned configuration, use the bootstrap -configuration file. A good starting point can be the default -[bootstrap-config-full.yaml]. By default the network, dns and gateway features +If your deployment requires a more fine-tuned configuration, use the bootstrap +configuration file. By default the network, dns and gateway features are enabled, but the ingress, load-balancer and local-storage features are disabled. @@ -58,11 +63,10 @@ cluster-config: EOF ``` - Then, apply the bootstrap configuration file: ``` -sudo k8s bootstrap --timeout 10m --file /path/to/bootstrap.yaml +sudo k8s bootstrap --file /path/to/bootstrap.yaml ``` To verify any changes to the built-in features run: @@ -73,5 +77,4 @@ sudo k8s status -[bootstrap-configuration-reference page]: /src/snap/reference/bootstrap-config-reference.md -[bootstrap-config-full.yaml]: https://raw.githubusercontent.com/canonical/k8s-snap/refs/heads/main/src/k8s/cmd/k8s/testdata/bootstrap-config-full.yaml \ No newline at end of file +[reference page]: /src/snap/reference/bootstrap-config-reference.md From 5b8d7be20a7eff5237252265870426fcdf07ef43 Mon Sep 17 00:00:00 2001 From: louiseschmidtgen Date: Fri, 10 Jan 2025 12:30:12 +0100 Subject: [PATCH 5/6] comments --- docs/src/_parts/bootstrap_config.md | 6 +++--- .../snap/howto/install/custom-bootstrap-config.md | 14 ++++++++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/docs/src/_parts/bootstrap_config.md b/docs/src/_parts/bootstrap_config.md index 2c07c061a..c0929f0d4 100644 --- a/docs/src/_parts/bootstrap_config.md +++ b/docs/src/_parts/bootstrap_config.md @@ -11,7 +11,7 @@ Configuration options for the network feature. **Type:** `bool`
Determines if the feature should be enabled. -If omitted defaults to `true` +If omitted defaults to `false` ### cluster-config.dns **Type:** `object`
@@ -22,7 +22,7 @@ Configuration options for the dns feature. **Type:** `bool`
Determines if the feature should be enabled. -If omitted defaults to `true` +If omitted defaults to `false` ### cluster-config.dns.cluster-domain **Type:** `string`
@@ -170,7 +170,7 @@ Configuration options for the gateway feature. **Type:** `bool`
Determines if the feature should be enabled. -If omitted defaults to `true`. +If omitted defaults to `false`. ### cluster-config.metrics-server **Type:** `object`
diff --git a/docs/src/snap/howto/install/custom-bootstrap-config.md b/docs/src/snap/howto/install/custom-bootstrap-config.md index 1f65e9e8b..20fa7f724 100644 --- a/docs/src/snap/howto/install/custom-bootstrap-config.md +++ b/docs/src/snap/howto/install/custom-bootstrap-config.md @@ -3,7 +3,7 @@ When creating a {{ product }} cluster that differs from the default configuration you can choose to use a custom bootstrap configuration. The CLI's interactive mode or a custom bootstrap configuration file allow you -to modify the configuration of the first node that will join your cluster. +to modify the configuration of the first node of your cluster. ## Configuration options @@ -47,19 +47,21 @@ The node will be 'Ready' to host workloads after the CNI is deployed successfull ## Bootstrap configuration file If your deployment requires a more fine-tuned configuration, use the bootstrap -configuration file. By default the network, dns and gateway features -are enabled, but the ingress, load-balancer and local-storage features are -disabled. +configuration file. +``` {note} +By default all features including network, dns, gateway, ingress, load-balancer +and local-storage are disabled. +``` -For this example, create a custom bootstrap configuration file that disables +For this example, create a custom bootstrap configuration file that enables the network feature: ```yaml cat < bootstrap.yaml cluster-config: network: - enabled: false + enabled: true EOF ``` From 886b195285de5d6ae49afc5d07dd7ca24159eaed Mon Sep 17 00:00:00 2001 From: louiseschmidtgen Date: Mon, 13 Jan 2025 11:01:28 +0100 Subject: [PATCH 6/6] comment --- docs/src/snap/howto/install/custom-bootstrap-config.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/src/snap/howto/install/custom-bootstrap-config.md b/docs/src/snap/howto/install/custom-bootstrap-config.md index 20fa7f724..edda88b66 100644 --- a/docs/src/snap/howto/install/custom-bootstrap-config.md +++ b/docs/src/snap/howto/install/custom-bootstrap-config.md @@ -50,8 +50,9 @@ If your deployment requires a more fine-tuned configuration, use the bootstrap configuration file. ``` {note} -By default all features including network, dns, gateway, ingress, load-balancer -and local-storage are disabled. +When using the custom configuration file on bootstrap, all features including +network, dns, gateway, ingress, load-balancer and local-storage are disabled +by default. ``` For this example, create a custom bootstrap configuration file that enables