Skip to content

Commit 2d4e23d

Browse files
authored
Merge branch 'main' into google-cloud-python
2 parents 4e644be + 859ee45 commit 2d4e23d

File tree

6 files changed

+304
-4
lines changed

6 files changed

+304
-4
lines changed

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

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

101+
### EKS KMS ARN (Optional)
102+
103+
You can use AWS Key Management Service (KMS) to enhance security by encrypting Kubernetes secrets in
104+
Amazon Elastic Kubernetes Service (EKS). This approach adds an extra layer of protection for sensitive
105+
information, like passwords, credentials, and TLS keys, by applying user-managed encryption keys to Kubernetes
106+
secrets, supporting a [defense-in-depth strategy](https://aws.amazon.com/blogs/containers/using-eks-encryption-provider-support-for-defense-in-depth/).
107+
108+
Nebari supports setting an existing KMS key while deploying Nebari to implement encryption of secrets
109+
created in Nebari's EKS cluster. The KMS key must be a **Symmetric** key set to **encrypt and decrypt** data.
110+
111+
:::warning
112+
Enabling EKS cluster secrets encryption, by setting `amazon_web_services.eks_kms_arn`, is an
113+
_irreversible_ action and re-deploying Nebari to try to remove a previously set `eks_kms_arn` will fail.
114+
On the other hand, if you try to change the KMS key in use for cluster encryption, by re-deploying Nebari
115+
after setting a _different_ key ARN, the re-deploy should succeed but the KMS key used for encryption will
116+
not actually change in the cluster config and the original key will remain set. The integrity of a faulty
117+
deployment can be restored, following a failed re-deploy attempt to remove a previously set KMS key, by
118+
simply re-deploying Nebari while ensuring `eks_kms_arn` is set to the original KMS key ARN.
119+
:::
120+
121+
:::danger
122+
If the KMS key used for envelope encryption of secrets is ever deleted, then there is no way to recover
123+
the EKS cluster.
124+
:::
125+
126+
:::note
127+
After enabling cluster encryption on your cluster, you must encrypt all existing secrets with the
128+
new key by running the following command:
129+
`kubectl get secrets --all-namespaces -o json | kubectl annotate --overwrite -f - kms-encryption-timestamp="time value"`
130+
Consult [Encrypt K8s secrets with AWS KMS on existing clusters](https://docs.aws.amazon.com/eks/latest/userguide/enable-kms.html) for more information.
131+
:::
132+
133+
Here is an example of how you would set KMS key ARN in `nebari-config.yaml`.
134+
135+
```yaml
136+
amazon_web_services:
137+
# the arn for the AWS Key Management Service key
138+
eks_kms_arn: "arn:aws:kms:us-west-2:01234567890:key/<aws-kms-key-id>"
139+
```
140+
141+
### Launch Templates (Optional)
142+
143+
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.
144+
145+
:::warning
146+
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.
147+
:::
148+
149+
:::tip
150+
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.
151+
:::
152+
153+
#### Configuring a Launch Template
154+
155+
To configure a launch template for a node group in your `nebari-config.yaml`, add the `launch_template` section under the desired node group:
156+
157+
```yaml
158+
amazon_web_services:
159+
region: us-west-2
160+
kubernetes_version: "1.18"
161+
node_groups:
162+
custom-node-group:
163+
instance: "m5.large"
164+
min_nodes: 1
165+
max_nodes: 5
166+
gpu: false # Set to true if using GPU instances
167+
launch_template:
168+
# Replace with your custom AMI ID
169+
ami_id: ami-0abcdef1234567890
170+
# Command to run before the node joins the cluster
171+
pre_bootstrap_command: |
172+
#!/bin/bash
173+
# This script is executed before the node is bootstrapped
174+
# You can use this script to install additional packages or configure the node
175+
# For example, to install the `htop` package, you can run:
176+
# sudo apt-get update
177+
# sudo apt-get install -y htop"
178+
```
179+
180+
**Parameters:**
181+
182+
- `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`.
183+
- `pre_bootstrap_command` (Optional): A command or script to execute on the node before
184+
it joins the Kubernetes cluster. This can be used for custom setup or configuration
185+
tasks. The format should be a single string in conformation with the shell syntax.
186+
This command is injected in the `user_data` field of the launch template. For more
187+
information, see [User Data](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html).
188+
189+
> 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.
190+
191+
:::note
192+
If an `ami_id` is not provided, AWS will use the default Amazon Linux 2 AMI for the
193+
specified instance type. You can find the latest optimized AMI IDs for Amazon EKS in your
194+
cluster region by inspecting its respective SSM parameters. For more information, see
195+
[Retrieve recommended Amazon Linux AMI IDs](https://docs.aws.amazon.com/eks/latest/userguide/retrieve-ami-id.html).
196+
:::
197+
101198
</TabItem>
102199

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

docs/docs/references/RELEASE.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ This file is copied to nebari-dev/nebari-docs using a GitHub Action. -->
99

1010
---
1111

12-
## Release 2024.9.1 - September 27, 2024
12+
## Release 2024.9.1 - September 27, 2024 (Broken Release)
13+
14+
> WARNING: This release was later found to have unresolved issues described further in [issue 2798](https://github.com/nebari-dev/nebari/issues/2798). We have marked this release as broken on conda-forge and yanked it on PyPI. One of the bugs prevents any upgrade from 2024.9.1 to 2024.11.1. Users should skip this release entirely and upgrade directly from 2024.7.1 to 2024.11.1.
1315
1416
> WARNING: This release changes how group directories are mounted in JupyterLab pods: only groups with specific permissions will have their directories mounted. If you rely on custom group mounts, we strongly recommend running `nebari upgrade` before updating. This will prompt you to confirm how Nebari should handle your groups—either keep them mounted or allow unmounting. **No data will be lost**, and you can reverse this anytime.
1517
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
## Deploying and Running Nebari from a Private Container Repository
2+
3+
Nebari deploys and runs FOSS components as containers running in Kubernetes.
4+
By default, Nebari sources each container from the container's respective public repository, typically `docker.io` or `quay.io`.
5+
This introduces supply-chain concerns for security-focused customers.
6+
7+
One solution to these supply-chain concerns is to deploy Nebari from private locally-mirrored containers:
8+
9+
- Create a controlled private container repository (e.g. ECR)
10+
- Mirror all containers used by Nebari into this private container repository
11+
- Use the `pre_bootstrap_command` mechanism in `nebari-config.yaml` to specify the mirrored container repo
12+
13+
Deploying Nebari in this fashion eliminates significant supply chain surface-area, but requires identifying all containers used by Nebari.
14+
15+
The following configurations demonstrate how to specify a private repo denoted by the string `[PRIVATE_REPO]`.
16+
17+
**Note:** Authorization tokens are used in the examples below. It is important for administrators to understand the expiration policy of these tokens, because the Nebari k8s cluster may in some cases need to **use these tokens to pull container images at any time during run-time operation**.
18+
19+
### Set ECR as default container registry mirror
20+
21+
```
22+
amazon_web_services:
23+
node_groups:
24+
general:
25+
instance: m5.2xlarge
26+
launch_template:
27+
pre_bootstrap_command: |
28+
#!/bin/bash
29+
# Verify that IP forwarding is enabled for worker nodes, as is required for containerd
30+
if [[ $(sysctl net.ipv4.ip_forward | grep "net.ipv4.ip_forward = 1") ]]; then echo "net.ipv4.ip_forward is on"; else sysctl -w net.ipv4.ip_forward=1; fi
31+
# Set ECR as default container registry mirror
32+
mkdir -p /etc/containerd/certs.d/_default
33+
ECR_TOKEN="$(aws ecr get-login-password --region us-east-1)"
34+
BASIC_AUTH="$(echo -n "AWS:$ECR_TOKEN" | base64 -w 0)"
35+
cat <<-EOT > /etc/containerd/certs.d/_default/hosts.toml
36+
[host."https://[PRIVATE_REPO].dkr.ecr.us-east-1.amazonaws.com"]
37+
capabilities = ["pull", "resolve"]
38+
[host."https://[PRIVATE_REPO].dkr.ecr.us-east-1.amazonaws.com".header]
39+
authorization = "Basic $BASIC_AUTH"
40+
EOT
41+
42+
```
43+
44+
### Set GitLab CR as default container registry mirror
45+
46+
```
47+
# Set GitLab CR as default container registry mirror in hosts.toml;
48+
# must have override_path set if project/group names don't match upstream container
49+
amazon_web_services:
50+
node_groups:
51+
general:
52+
instance: m5.2xlarge
53+
launch_template:
54+
pre_bootstrap_command: |
55+
#!/bin/bash
56+
# Verify that IP forwarding is enabled for worker nodes, as is required for containerd
57+
if [[ $(sysctl net.ipv4.ip_forward | grep "net.ipv4.ip_forward = 1") ]]; then echo "net.ipv4.ip_forward is on"; else sysctl -w net.ipv4.ip_forward=1; fi
58+
# Set default container registry mirror in hosts.toml; must have override_path set if project/group names don't match upstream container
59+
CONTAINER_REGISTRY_URL="[PRIVATE_REPO]"
60+
CONTAINER_REGISTRY_USERNAME="[username]"
61+
CONTAINER_REGISTRY_TOKEN="[token]"
62+
CONTAINER_REGISTRY_GROUP=as-nebari
63+
CONTAINER_REGISTRY_PROJECT=nebari-test
64+
mkdir -p /etc/containerd/certs.d/_default
65+
cat <<-EOT > /etc/containerd/certs.d/_default/hosts.toml
66+
[host."https://$CONTAINER_REGISTRY_URL/v2/$CONTAINER_REGISTRY_GROUP/$CONTAINER_REGISTRY_PROJECT"]
67+
override_path = true
68+
capabilities = ["pull", "resolve"]
69+
EOT
70+
71+
# Set containerd registry config auth in config.d .toml import dir
72+
mkdir -p /etc/containerd/config.d
73+
cat <<EOT | sudo tee /etc/containerd/config.d/config-import.toml
74+
version = 2
75+
[plugins."io.containerd.grpc.v1.cri".registry]
76+
config_path = "/etc/containerd/certs.d:/etc/docker/certs.d"
77+
[plugins."io.containerd.grpc.v1.cri".registry.auths]
78+
[plugins."io.containerd.grpc.v1.cri".registry.configs]
79+
[plugins."io.containerd.grpc.v1.cri".registry.configs."$CONTAINER_REGISTRY_URL".auth]
80+
username = "$CONTAINER_REGISTRY_USERNAME"
81+
password = "$CONTAINER_REGISTRY_TOKEN"
82+
EOT
83+
```
84+
85+
### Set GitLab CR as default container registry mirror, with custom Client SSL/TLS Certs
86+
87+
```
88+
# must have override_path set if project/group names don't match upstream container
89+
# Also add/set GitLab Client SSL/TLS Certificate for Containerd
90+
amazon_web_services:
91+
node_groups:
92+
general:
93+
instance: m5.2xlarge
94+
launch_template:
95+
pre_bootstrap_command: |
96+
#!/bin/bash
97+
# Verify that IP forwarding is enabled for worker nodes, as is required for containerd
98+
if [[ $(sysctl net.ipv4.ip_forward | grep "net.ipv4.ip_forward = 1") ]]; then echo "net.ipv4.ip_forward is on"; else sysctl -w net.ipv4.ip_forward=1; fi
99+
# Set default container registry mirror in hosts.toml; must have override_path set if project/group names don't match upstream container
100+
CONTAINER_REGISTRY_URL="[PRIVATE_REPO]"
101+
CONTAINER_REGISTRY_USERNAME="[username]"
102+
CONTAINER_REGISTRY_TOKEN="[token]"
103+
CONTAINER_REGISTRY_GROUP=as-nebari
104+
CONTAINER_REGISTRY_PROJECT=nebari-test
105+
mkdir -p /etc/containerd/certs.d/_default
106+
cat <<-EOT > /etc/containerd/certs.d/_default/hosts.toml
107+
[host."https://$CONTAINER_REGISTRY_URL/v2/$CONTAINER_REGISTRY_GROUP/$CONTAINER_REGISTRY_PROJECT"]
108+
override_path = true
109+
capabilities = ["pull", "resolve"]
110+
client = ["/etc/containerd/certs.d/$CONTAINER_REGISTRY_URL/client.pem"]
111+
EOT
112+
113+
# Set containerd registry config auth in config.d .toml import dir
114+
mkdir -p /etc/containerd/config.d
115+
cat <<EOT | sudo tee /etc/containerd/config.d/config-import.toml
116+
version = 2
117+
[plugins."io.containerd.grpc.v1.cri".registry]
118+
config_path = "/etc/containerd/certs.d:/etc/docker/certs.d"
119+
[plugins."io.containerd.grpc.v1.cri".registry.auths]
120+
[plugins."io.containerd.grpc.v1.cri".registry.configs]
121+
[plugins."io.containerd.grpc.v1.cri".registry.configs."$CONTAINER_REGISTRY_URL".auth]
122+
username = "$CONTAINER_REGISTRY_USERNAME"
123+
password = "$CONTAINER_REGISTRY_TOKEN"
124+
EOT
125+
126+
# Add client key/cert to containerd
127+
mkdir -p /etc/containerd/certs.d/$CONTAINER_REGISTRY_URL
128+
cat <<-EOT >> /etc/containerd/certs.d/$CONTAINER_REGISTRY_URL/client.pem
129+
-----BEGIN CERTIFICATE-----
130+
XzxzxzxzxxzxzxzxzxzxzxzxxzxzxzxzxzxzxzxxzxzxzxzxzxzxzxzxzxxzxzZx
131+
ZxyzxzxzxxzxzxzxzxzxzxzxxzxzxzxzxzxzxzxxzxzxzxzxzxzxzxzxzxxzxzXz
132+
-----END CERTIFICATE-----
133+
-----BEGIN PRIVATE KEY-----
134+
XzxzxzxzxxzxzxzxzxzxzxzxxzxzxzxzxzxzxzxxzxzxzxzxzxzxzxzxzxxzxzZx
135+
ZxyzxzxzxxzxzxzxzxzxzxzxxzxzxzxzxzxzxzxxzxzxzxzxzxzxzxzxzxxzxzXz
136+
-----END PRIVATE KEY-----
137+
EOT
138+
```
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
## Nebari Security Considerations
2+
3+
The security of _AWS Nebari_ deployments can be enhanced through the following deployment configuration options in `nebari-config.yaml`:
4+
5+
- **Explicit definition of container sources**
6+
This option allows for the use of locally mirrored, security-hardened, or otherwise customized container images in place of the containers used by default.
7+
See: [container-sources](container-sources.md)
8+
9+
- **Installation of custom SSL certificate(s) into EKS hosts**
10+
Install private certificates used by (e.g.) in-line content inspection engines which re-encrypt traffic.
11+
12+
```
13+
# Add client certificate to CA trust on node
14+
amazon_web_services:
15+
node_groups:
16+
general:
17+
instance: m5.2xlarge
18+
launch_template:
19+
pre_bootstrap_command: |
20+
#!/bin/bash
21+
cat <<-EOT >> /etc/pki/ca-trust/source/anchors/client.pem
22+
-----BEGIN CERTIFICATE-----
23+
XzxzxzxzxxzxzxzxzxzxzxzxxzxzxzxzxzxzxzxxzxzxzxzxzxzxzxzxzxxzxzZx
24+
ZxyzxzxzxxzxzxzxzxzxzxzxxzxzxzxzxzxzxzxxzxzxzxzxzxzxzxzxzxxzxzXz
25+
-----END CERTIFICATE-----
26+
EOT
27+
sudo update-ca-trust extract
28+
```
29+
30+
- **Private EKS endpoint configuration**
31+
Mirrors the corresponding AWS console option, which routes all EKS traffic within the VPC.
32+
33+
```
34+
amazon_web_services:
35+
eks_endpoint_access: private # valid values: [public, private, public_and_private]
36+
```
37+
38+
- **Deploy into existing subnets**
39+
Instructs Nebari to be deployed into existing subnets, rather than creating its own new subnets.
40+
An advantage of deploying to existing subnets is the ability to use private subnets. Note that the **ingress load-balancer-annotation** must be set appropriately based on the type (private or public) of subnet.
41+
42+
```
43+
existing_subnet_ids:
44+
- subnet-0123456789abcdef
45+
- subnet-abcdef0123456789
46+
existing_security_group_id: sg-0123456789abcdef
47+
ingress:
48+
terraform_overrides:
49+
load-balancer-annotations:
50+
service.beta.kubernetes.io/aws-load-balancer-internal: "true"
51+
# Ensure the subnet IDs are also set below
52+
service.beta.kubernetes.io/aws-load-balancer-subnets: "subnet-0123456789abcdef,subnet-abcdef0123456789"
53+
```
54+
55+
- **Use existing SSL certificate**
56+
Instructs Nebari to use the SSL certificate specified by `[k8s-custom-secret-name]`
57+
58+
```
59+
certificate:
60+
type: existing
61+
secret_name: [k8s-custom-secret-name]
62+
```

docs/docs/references/index.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
1111
/>
1212
</div>
1313

14-
Nitty-gritty technical descriptions of how Nebari works.
14+
Technical descriptions of how Nebari works.
1515

16+
- [Enhanced Security](enhanced-security.md) - Nebari security configuration guide
17+
- [Local Container Repo](container-sources.md) - Deploying Nebari from a Local Container Repo
1618
<DocCardList items={useCurrentSidebarCategory().items}/>

docs/nebari-slurm/configuration.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,7 @@ _Note_: All slurm related configuration needs to be passed down as a string.
186186
### Services
187187
188188
Additional services can be added to the `jupyterhub_services`
189-
variable. Currently this is only `<service-name>:
190-
<service-apikey>`. You must keep the `dask_gateway` section.
189+
variable. Currently this is only `<service-name>: <service-apikey>`. You must keep the `dask_gateway` section.
191190

192191
```yaml
193192
jupyterhub_services:

0 commit comments

Comments
 (0)