tfy-karpenter-config
by TrueFoundry
Karpenter resources to manage workloads
About this chart
karpenter-config helm chart packaged by TrueFoundry
A Helm chart for Karpenter provisioners.
EKS Auto Mode
Set karpenter.eksAutoMode.enabled=true to render eks.amazonaws.com/v1 NodeClass resources and update NodePool.spec.template.spec.nodeClassRef to:
group: eks.amazonaws.comkind: NodeClass
In EKS Auto Mode, the chart uses the requirement key eks.amazonaws.com/instance-category (not eks.amazonaws.com/instance-family).
You can provide explicit instanceCategories per NodePool, or keep using instanceFamilies and let the chart infer categories from family names.
When karpenter.eksAutoMode.enabled=false (default), the chart continues to render karpenter.k8s.aws/v1 EC2NodeClass resources.
Soci
You can add soci-snapshotter in the nodes brought up by Karpenter using the userData field in the EC2NodeClass resource.
The script in userData does the following,
- Install and load the
fusekernel module. - Download the binary from the
awslabs/soci-snapshotterrelease page. - Adds a configuration file for the
soci-snapshotter-grpcbinary. - Adds a
systemdservice, which manages thesoci-snapshotter-grpcprocess. - Patches
containerdandkubeletconfig to use thesoci-snapshotter.
Note that soci-snapshotter with containerd <1.7.16 does not enforce storage limits.
userData script for default (CPU) EC2 Node Class
- AL2023
userData script for gpu-default (GPU) EC2 Node Class
- AL2023
Debugging
https://github.com/awslabs/soci-snapshotter/blob/2e3df4a92415ff02ccc76ed9ceb1c25ef9b5c75f/docs/debug.md
-
Shell into the Node.
-
To identify whether the snapshotter is being used, we can use the command below.
mount | grep fuseWe should see mounts like,
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime) soci on /var/lib/soci-snapshotter-grpc/snapshotter/snapshots/63/fs type fuse.rawBridge (rw,nodev,relatime,user_id=0,group_id=0,allow_other,max_read=131072) soci on /var/lib/soci-snapshotter-grpc/snapshotter/snapshots/67/fs type fuse.rawBridge (rw,nodev,relatime,user_id=0,group_id=0,allow_other,max_read=131072) soci on /var/lib/soci-snapshotter-grpc/snapshotter/snapshots/72/fs type fuse.rawBridge (rw,nodev,relatime,user_id=0,group_id=0,allow_other,max_read=131072) soci on /var/lib/soci-snapshotter-grpc/snapshotter/snapshots/75/fs type fuse.rawBridge (rw,nodev,relatime,user_id=0,group_id=0,allow_other,max_read=131072) soci on /var/lib/soci-snapshotter-grpc/snapshotter/snapshots/81/fs type fuse.rawBridge (rw,nodev,relatime,user_id=0,group_id=0,allow_other,max_read=131072) soci on /var/lib/soci-snapshotter-grpc/snapshotter/snapshots/84/fs type fuse.rawBridge (rw,nodev,relatime,user_id=0,group_id=0,allow_other,max_read=131072) soci on /var/lib/soci-snapshotter-grpc/snapshotter/snapshots/87/fs type fuse.rawBridge (rw,nodev,relatime,user_id=0,group_id=0,allow_other,max_read=131072)If you do not see any fuse mounts, that means the snapshotter may not be running or no container image has soci index.
-
Use the commands below to check the status of the snapshotter service and logs.
systemctl status soci-snapshotter journalctl -u soci-snapshotter -e
Parameters
Cluster configurations
| Name | Description | Value |
|---|---|---|
cluster.name | Name of the EKS cluster | $CLUSTER_NAME |
Karpenter configurations
| Name | Description | Value |
|---|---|---|
karpenter.instanceProfile | Instance profile of the karpenter | "" |
karpenter.eksAutoMode.enabled | Enable EKS Auto Mode NodeClass rendering (NodeClass) instead of Karpenter EC2NodeClass. | false |
karpenter.defaultNodeTemplate.create | Specifies if the default node class should be created. | true |
karpenter.defaultNodeTemplate.name | Name of the AWS node class | default |
karpenter.defaultNodeTemplate.instanceProfile | Instance profile override for the node template | "" |
karpenter.defaultNodeTemplate.rootVolumeSize | Size for the root volume attached to node | 100Gi |
karpenter.defaultNodeTemplate.rootVolumeThroughput | Throughput in MiB/s for the gp3 root volume. Leave empty to use the AWS default (125 MiB/s). | "" |
karpenter.defaultNodeTemplate.encrypted | Encryption for EBS volumes | true |
karpenter.defaultNodeTemplate.kmsKeyID | KMS key ID for EBS volume encryption. Leave empty to use AWS default key. | "" |
karpenter.defaultNodeTemplate.extraTags | Additional tags for the node template. | {} |
karpenter.defaultNodeTemplate.amiFamily | AMI family to use for node template | "" |
karpenter.defaultNodeTemplate.amiSelectorTerms | AMI selector terms for the node template, conditions are ANDed | [] |
karpenter.defaultNodeTemplate.userData | User data to append in the default node template. Set this to "" to disable injection. | "" |
karpenter.defaultNodeTemplate.enableSoci | Enable SOCI for the default nodes. | false |
karpenter.defaultNodeTemplate.metadataOptions | Metadata options to be passed to the default node template. | {} |
karpenter.defaultNodeTemplate.detailedMonitoring | Set this to true to enable EC2 detailed cloudwatch monitoring. | false |
karpenter.defaultNodeTemplate.extraSubnetTags | Additional tags for the subnet. | {} |
karpenter.defaultNodeTemplate.extraSecurityGroupTags | Additional tags for the security group. | {} |
karpenter.defaultNodePool.create | Specifies if the default node pool should be created. | true |
karpenter.defaultNodePool.name | Name of the default node pool | default-nodepool |
karpenter.defaultNodePool.weight | Weight for the default node pool | 10 |
karpenter.defaultNodePool.labels | Labels for the default node pool | {} |
karpenter.defaultNodePool.taints | Taints for the default node pool | [] |
karpenter.defaultNodePool.disruption | Consolidation policy for disruption | {} |
karpenter.defaultNodePool.expireAfter | Duration after which nodes are expired and replaced. Set to "Never" to disable. | 720h |
karpenter.defaultNodePool.capacityTypes | Capacity types for the default node pool | [] |
karpenter.defaultNodePool.zones | Zones for the default node pool | [] |
karpenter.defaultNodePool.architectures | Architectures for the default node pool | [] |
karpenter.defaultNodePool.instanceGeneration | Minimum instance generation (exclusive). Gt "5" requires gen 6+. | 5 |
karpenter.defaultNodePool.instanceFamilies.notAllowed | Not allowed instance families for the default node pool | [] |
karpenter.defaultNodePool.instanceCategories.allowed | Allowed instance categories for EKS Auto Mode. If empty, categories are inferred from instanceFamilies.allowed. | [] |
karpenter.defaultNodePool.instanceCategories.notAllowed | Not allowed instance categories for EKS Auto Mode. If key is omitted |
Deploy tfy-karpenter-config with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has tfy-karpenter-config on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the charttfy-karpenter-config is pinned at v0.1.62 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply