# This example provisioner will provision instances using the AL2 EKS-Optimized AMI. # The UserData defined in spec.UserData needs to be in the MIME-multipart format, # and will be prepended to a Karpenter managed section that will bootstrap the kubelet. apiVersion: karpenter.sh/v1alpha5 kind: Provisioner metadata: name: default spec: limits: resources: cpu: 20 providerRef: name: al2 consolidation: enabled: true --- apiVersion: karpenter.k8s.aws/v1alpha1 kind: AWSNodeTemplate metadata: name: al2 spec: amiFamily: AL2 instanceProfile: myInstanceProfile subnetSelector: karpenter.sh/discovery: my-cluster securityGroupSelector: karpenter.sh/discovery: my-cluster userData: | MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="BOUNDARY" --BOUNDARY Content-Type: text/x-shellscript; charset="us-ascii" #!/bin/bash echo "Running a custom user data script" --BOUNDARY--