Panfactum LogoPanfactum
Infrastructure ModulesDirect ModulesKuberneteskube_karpenter
kube_karpenter_node_pools
Stable
Direct
Source Code Link

Karpenter NodePools

Providers

The following providers are needed by this module:

  • aws (5.39.1)

  • kubectl (2.0.4)

  • kubernetes (2.27.0)

  • random (3.6.0)

Required Inputs

The following input variables are required:

cluster_ca_data

Description: The B64 encoded CA data of the API server of the eks cluster

Type: string

cluster_dns_service_ip

Description: The IP address of the cluster's DNS service.

Type: string

cluster_endpoint

Description: The URL of the API server of the eks cluster

Type: string

cluster_name

Description: The name of the eks cluster

Type: string

node_instance_profile

Description: The instance profile to use for launched nodes

Type: string

node_security_group_id

Description: The id of the security group for nodes running in the EKS cluster

Type: string

node_subnets

Description: List of subnet names to deploy Karpenter nodes into.

Type: set(string)

node_vpc_id

Description: The ID of the VPC to deploy Karpenter nodes into.

Type: string

Optional Inputs

The following input variables are optional (have default values):

monitoring_enabled

Description: Whether to active monitoring has been added to the cluster

Type: bool

Default: false

node_labels

Description: Labels to apply to nodes generated by Karpenter

Type: map(string)

Default: {}

Outputs

The following outputs are exported:

user_data

Description: n/a

Maintainer Notes

We make heavy use of random_id and create_before_destroy because Karpenter often updates its CRD spec, and changes to this spec requires destroying old CRs. However, we cannot just naively destroy these CRs as (a) destroying a CR de-provisions all nodes created by it and (b) destroying all CRs at once would leave Karpenter unable to create new nodes for the disrupted pods. Obviously this is not desirable in a live cluster.

As a result, we create new CRs before destroying the old ones so that when we destroy the old ones, Karpenter can create new nodes for the disrupted pods.