Skip to content

Commit fbb82bf

Browse files
authored
Merge branch 'main' into 536-eks-cluster-encryption
2 parents 1874a5c + a89196c commit fbb82bf

File tree

1 file changed

+57
-6
lines changed

1 file changed

+57
-6
lines changed

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

Lines changed: 57 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,31 +112,25 @@ Nebari supports setting an existing KMS key while deploying Nebari to implement
112112
created in Nebari's EKS cluster. The KMS key must be a **Symmetric** key set to **encrypt and decrypt** data.
113113

114114
:::warning
115-
116115
Enabling EKS cluster secrets encryption, by setting `amazon_web_services.eks_kms_arn`, is an
117116
_irreversible_ action and re-deploying Nebari to try to remove a previously set `eks_kms_arn` will fail.
118117
On the other hand, if you try to change the KMS key in use for cluster encryption, by re-deploying Nebari
119118
after setting a _different_ key ARN, the re-deploy should succeed but the KMS key used for encryption will
120119
not actually change in the cluster config and the original key will remain set. The integrity of a faulty
121120
deployment can be restored, following a failed re-deploy attempt to remove a previously set KMS key, by
122121
simply re-deploying Nebari while ensuring `eks_kms_arn` is set to the original KMS key ARN.
123-
124122
:::
125123

126124
:::danger
127-
128125
If the KMS key used for envelope encryption of secrets is ever deleted, then there is no way to recover
129126
the EKS cluster.
130-
131127
:::
132128

133129
:::note
134-
135130
After enabling cluster encryption on your cluster, you must encrypt all existing secrets with the
136131
new key by running the following command:
137132
`kubectl get secrets --all-namespaces -o json | kubectl annotate --overwrite -f - kms-encryption-timestamp="time value"`
138133
Consult [Encrypt K8s secrets with AWS KMS on existing clusters](https://docs.aws.amazon.com/eks/latest/userguide/enable-kms.html) for more information.
139-
140134
:::
141135

142136
Here is an example of how you would set KMS key ARN in `nebari-config.yaml`.
@@ -147,6 +141,63 @@ amazon_web_services:
147141
eks_kms_arn: 'arn:aws:kms:us-west-2:01234567890:key/<aws-kms-key-id>'
148142
```
149143

144+
### Launch Templates (Optional)
145+
146+
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.
147+
148+
:::warning
149+
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.
150+
:::
151+
152+
:::tip
153+
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.
154+
:::
155+
156+
#### Configuring a Launch Template
157+
158+
To configure a launch template for a node group in your `nebari-config.yaml`, add the `launch_template` section under the desired node group:
159+
160+
```yaml
161+
amazon_web_services:
162+
region: us-west-2
163+
kubernetes_version: "1.18"
164+
node_groups:
165+
custom-node-group:
166+
instance: "m5.large"
167+
min_nodes: 1
168+
max_nodes: 5
169+
gpu: false # Set to true if using GPU instances
170+
launch_template:
171+
# Replace with your custom AMI ID
172+
ami_id: ami-0abcdef1234567890
173+
# Command to run before the node joins the cluster
174+
pre_bootstrap_command: |
175+
#!/bin/bash
176+
# This script is executed before the node is bootstrapped
177+
# You can use this script to install additional packages or configure the node
178+
# For example, to install the `htop` package, you can run:
179+
# sudo apt-get update
180+
# sudo apt-get install -y htop"
181+
```
182+
183+
**Parameters:**
184+
185+
- `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`.
186+
- `pre_bootstrap_command` (Optional): A command or script to execute on the node before
187+
it joins the Kubernetes cluster. This can be used for custom setup or configuration
188+
tasks. The format should be a single string in conformation with the shell syntax.
189+
This command is injected in the `user_data` field of the launch template. For more
190+
information, see [User Data](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html).
191+
192+
> 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.
193+
194+
:::note
195+
If an `ami_id` is not provided, AWS will use the default Amazon Linux 2 AMI for the
196+
specified instance type. You can find the latest optimized AMI IDs for Amazon EKS in your
197+
cluster region by inspecting its respective SSM parameters. For more information, see
198+
[Retrieve recommended Amazon Linux AMI IDs](https://docs.aws.amazon.com/eks/latest/userguide/retrieve-ami-id.html).
199+
:::
200+
150201
</TabItem>
151202

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

0 commit comments

Comments
 (0)