tfy-karpenter-config

by TrueFoundry

Helm chartv0.1.62Verified publisher

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.com
  • kind: 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,

  1. Install and load the fuse kernel module.
  2. Download the binary from the awslabs/soci-snapshotter release page.
  3. Adds a configuration file for the soci-snapshotter-grpc binary.
  4. Adds a systemd service, which manages the soci-snapshotter-grpc process.
  5. Patches containerd and kubelet config to use the soci-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

  1. Shell into the Node.

  2. To identify whether the snapshotter is being used, we can use the command below.

    mount | grep fuse
    

    We 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.

  3. 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

NameDescriptionValue
cluster.nameName of the EKS cluster$CLUSTER_NAME

Karpenter configurations

NameDescriptionValue
karpenter.instanceProfileInstance profile of the karpenter""
karpenter.eksAutoMode.enabledEnable EKS Auto Mode NodeClass rendering (NodeClass) instead of Karpenter EC2NodeClass.false
karpenter.defaultNodeTemplate.createSpecifies if the default node class should be created.true
karpenter.defaultNodeTemplate.nameName of the AWS node classdefault
karpenter.defaultNodeTemplate.instanceProfileInstance profile override for the node template""
karpenter.defaultNodeTemplate.rootVolumeSizeSize for the root volume attached to node100Gi
karpenter.defaultNodeTemplate.rootVolumeThroughputThroughput in MiB/s for the gp3 root volume. Leave empty to use the AWS default (125 MiB/s).""
karpenter.defaultNodeTemplate.encryptedEncryption for EBS volumestrue
karpenter.defaultNodeTemplate.kmsKeyIDKMS key ID for EBS volume encryption. Leave empty to use AWS default key.""
karpenter.defaultNodeTemplate.extraTagsAdditional tags for the node template.{}
karpenter.defaultNodeTemplate.amiFamilyAMI family to use for node template""
karpenter.defaultNodeTemplate.amiSelectorTermsAMI selector terms for the node template, conditions are ANDed[]
karpenter.defaultNodeTemplate.userDataUser data to append in the default node template. Set this to "" to disable injection.""
karpenter.defaultNodeTemplate.enableSociEnable SOCI for the default nodes.false
karpenter.defaultNodeTemplate.metadataOptionsMetadata options to be passed to the default node template.{}
karpenter.defaultNodeTemplate.detailedMonitoringSet this to true to enable EC2 detailed cloudwatch monitoring.false
karpenter.defaultNodeTemplate.extraSubnetTagsAdditional tags for the subnet.{}
karpenter.defaultNodeTemplate.extraSecurityGroupTagsAdditional tags for the security group.{}
karpenter.defaultNodePool.createSpecifies if the default node pool should be created.true
karpenter.defaultNodePool.nameName of the default node pooldefault-nodepool
karpenter.defaultNodePool.weightWeight for the default node pool10
karpenter.defaultNodePool.labelsLabels for the default node pool{}
karpenter.defaultNodePool.taintsTaints for the default node pool[]
karpenter.defaultNodePool.disruptionConsolidation policy for disruption{}
karpenter.defaultNodePool.expireAfterDuration after which nodes are expired and replaced. Set to "Never" to disable.720h
karpenter.defaultNodePool.capacityTypesCapacity types for the default node pool[]
karpenter.defaultNodePool.zonesZones for the default node pool[]
karpenter.defaultNodePool.architecturesArchitectures for the default node pool[]
karpenter.defaultNodePool.instanceGenerationMinimum instance generation (exclusive). Gt "5" requires gen 6+.5
karpenter.defaultNodePool.instanceFamilies.notAllowedNot allowed instance families for the default node pool[]
karpenter.defaultNodePool.instanceCategories.allowedAllowed instance categories for EKS Auto Mode. If empty, categories are inferred from instanceFamilies.allowed.[]
karpenter.defaultNodePool.instanceCategories.notAllowedNot 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.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the charttfy-karpenter-config is pinned at v0.1.62 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. 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