Skip to content

Commit a89196c

Browse files
authored
Merge pull request #525 from nebari-dev/524-launch-template
Add `launch_template` usage docs
2 parents 98e79a6 + 5b35cb6 commit a89196c

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

docs/docs/explanations/advanced-provider-configuration.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,63 @@ amazon_web_services:
9898
permissions_boundary: arn:aws:iam::01234567890:policy/<permissions-boundary-policy-name>
9999
```
100100

101+
### Launch Templates (Optional)
102+
103+
Nebari supports configuring launch templates for your node groups, enabling you to customize settings like the AMI ID and pre-bootstrap commands. This is particularly useful if you need to use a custom AMI or perform specific actions before the node joins the cluster.
104+
105+
:::warning
106+
If you add a `launch_template` to an existing node group that was previously created without one, AWS will treat this as a change requiring the replacement of the entire node group. This action will trigger a reallocation of resources, effectively destroying the current node group and recreating it. This behavior is due to how AWS handles self-managed node groups versus those using launch templates with custom settings.
107+
:::
108+
109+
:::tip
110+
To avoid unexpected downtime or data loss, consider creating a new node group with the launch template settings and migrating your workloads accordingly. This approach allows you to implement the new configuration without disrupting your existing resources.
111+
:::
112+
113+
#### Configuring a Launch Template
114+
115+
To configure a launch template for a node group in your `nebari-config.yaml`, add the `launch_template` section under the desired node group:
116+
117+
```yaml
118+
amazon_web_services:
119+
region: us-west-2
120+
kubernetes_version: "1.18"
121+
node_groups:
122+
custom-node-group:
123+
instance: "m5.large"
124+
min_nodes: 1
125+
max_nodes: 5
126+
gpu: false # Set to true if using GPU instances
127+
launch_template:
128+
# Replace with your custom AMI ID
129+
ami_id: ami-0abcdef1234567890
130+
# Command to run before the node joins the cluster
131+
pre_bootstrap_command: |
132+
#!/bin/bash
133+
# This script is executed before the node is bootstrapped
134+
# You can use this script to install additional packages or configure the node
135+
# For example, to install the `htop` package, you can run:
136+
# sudo apt-get update
137+
# sudo apt-get install -y htop"
138+
```
139+
140+
**Parameters:**
141+
142+
- `ami_id` (Optional): The ID of the custom AMI to use for the nodes in this group; this assumes the AMI provided is an EKS-optimized AMI derivative. If specified, the `ami_type` is automatically set to `CUSTOM`.
143+
- `pre_bootstrap_command` (Optional): A command or script to execute on the node before
144+
it joins the Kubernetes cluster. This can be used for custom setup or configuration
145+
tasks. The format should be a single string in conformation with the shell syntax.
146+
This command is injected in the `user_data` field of the launch template. For more
147+
information, see [User Data](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html).
148+
149+
> If you're using a `launch_template` with a custom `ami_id`, there's an issue with updating the `scaling.desired_size` via Nebari configuration (terraform). To scale up, you must recreate the node group or adjust the scaling settings directly in the AWS Console UI (recommended). We are aware of this inconsistency and plan to address it in a future update.
150+
151+
:::note
152+
If an `ami_id` is not provided, AWS will use the default Amazon Linux 2 AMI for the
153+
specified instance type. You can find the latest optimized AMI IDs for Amazon EKS in your
154+
cluster region by inspecting its respective SSM parameters. For more information, see
155+
[Retrieve recommended Amazon Linux AMI IDs](https://docs.aws.amazon.com/eks/latest/userguide/retrieve-ami-id.html).
156+
:::
157+
101158
</TabItem>
102159

103160
<TabItem value="azure" label="Azure">

0 commit comments

Comments
 (0)