NodeGroup

class NodeGroup : KotlinCustomResource

Manages an EKS Node Group, which can provision and optionally update an Auto Scaling Group of Kubernetes worker nodes compatible with EKS. Additional documentation about this functionality can be found in the EKS User Guide.

Example Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.eks.NodeGroup;
import com.pulumi.aws.eks.NodeGroupArgs;
import com.pulumi.aws.eks.inputs.NodeGroupScalingConfigArgs;
import com.pulumi.aws.eks.inputs.NodeGroupUpdateConfigArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new NodeGroup("example", NodeGroupArgs.builder()
.clusterName(aws_eks_cluster.example().name())
.nodeRoleArn(aws_iam_role.example().arn())
.subnetIds(aws_subnet.example().stream().map(element -> element.id()).collect(toList()))
.scalingConfig(NodeGroupScalingConfigArgs.builder()
.desiredSize(1)
.maxSize(2)
.minSize(1)
.build())
.updateConfig(NodeGroupUpdateConfigArgs.builder()
.maxUnavailable(1)
.build())
.build(), CustomResourceOptions.builder()
.dependsOn(
aws_iam_role_policy_attachment.example-AmazonEKSWorkerNodePolicy(),
aws_iam_role_policy_attachment.example-AmazonEKS_CNI_Policy(),
aws_iam_role_policy_attachment.example-AmazonEC2ContainerRegistryReadOnly())
.build());
}
}

Ignoring Changes to Desired Size

You can utilize ignoreChanges create an EKS Node Group with an initial size of running instances, then ignore any changes to that count caused externally (e.g. Application Autoscaling).

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.eks.NodeGroup;
import com.pulumi.aws.eks.NodeGroupArgs;
import com.pulumi.aws.eks.inputs.NodeGroupScalingConfigArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new NodeGroup("example", NodeGroupArgs.builder()
.scalingConfig(NodeGroupScalingConfigArgs.builder()
.desiredSize(2)
.build())
.build());
}
}

Example IAM Role for EKS Node Group

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.iam.Role;
import com.pulumi.aws.iam.RoleArgs;
import com.pulumi.aws.iam.RolePolicyAttachment;
import com.pulumi.aws.iam.RolePolicyAttachmentArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new Role("example", RoleArgs.builder()
.assumeRolePolicy(serializeJson(
jsonObject(
jsonProperty("Statement", jsonArray(jsonObject(
jsonProperty("Action", "sts:AssumeRole"),
jsonProperty("Effect", "Allow"),
jsonProperty("Principal", jsonObject(
jsonProperty("Service", "ec2.amazonaws.com")
))
))),
jsonProperty("Version", "2012-10-17")
)))
.build());
var example_AmazonEKSWorkerNodePolicy = new RolePolicyAttachment("example-AmazonEKSWorkerNodePolicy", RolePolicyAttachmentArgs.builder()
.policyArn("arn:aws:iam::aws:policy/AmazonEKSWorkerNodePolicy")
.role(example.name())
.build());
var example_AmazonEKSCNIPolicy = new RolePolicyAttachment("example-AmazonEKSCNIPolicy", RolePolicyAttachmentArgs.builder()
.policyArn("arn:aws:iam::aws:policy/AmazonEKS_CNI_Policy")
.role(example.name())
.build());
var example_AmazonEC2ContainerRegistryReadOnly = new RolePolicyAttachment("example-AmazonEC2ContainerRegistryReadOnly", RolePolicyAttachmentArgs.builder()
.policyArn("arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly")
.role(example.name())
.build());
}
}

Import

EKS Node Groups can be imported using the cluster_name and node_group_name separated by a colon (:), e.g.,

$ pulumi import aws:eks/nodeGroup:NodeGroup my_node_group my_cluster:my_node_group

Properties

Link copied to clipboard
val amiType: Output<String>

Type of Amazon Machine Image (AMI) associated with the EKS Node Group. See the AWS documentation for valid values. This provider will only perform drift detection if a configuration value is provided.

Link copied to clipboard
val arn: Output<String>

Amazon Resource Name (ARN) of the EKS Node Group.

Link copied to clipboard
val capacityType: Output<String>

Type of capacity associated with the EKS Node Group. Valid values: ON_DEMAND, SPOT. This provider will only perform drift detection if a configuration value is provided.

Link copied to clipboard
val clusterName: Output<String>

Name of the EKS Cluster. Must be between 1-100 characters in length. Must begin with an alphanumeric character, and must only contain alphanumeric characters, dashes and underscores (^[0-9A-Za-z][A-Za-z0-9\-_]+$).

Link copied to clipboard
val diskSize: Output<Int>

Disk size in GiB for worker nodes. Defaults to 50 for Windows, 20 all other node groups. The provider will only perform drift detection if a configuration value is provided.

Link copied to clipboard

Force version update if existing pods are unable to be drained due to a pod disruption budget issue.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val instanceTypes: Output<List<String>>

List of instance types associated with the EKS Node Group. Defaults to ["t3&#46;medium"]. The provider will only perform drift detection if a configuration value is provided.

Link copied to clipboard
val labels: Output<Map<String, String>>?

Key-value map of Kubernetes labels. Only labels that are applied with the EKS API are managed by this argument. Other Kubernetes labels applied to the EKS Node Group will not be managed.

Link copied to clipboard

Configuration block with Launch Template settings. Detailed below.

Link copied to clipboard
val nodeGroupName: Output<String>

Name of the EKS Node Group. If omitted, the provider will assign a random, unique name. Conflicts with node_group_name_prefix. The node group name can't be longer than 63 characters. It must start with a letter or digit, but can also include hyphens and underscores for the remaining characters.

Link copied to clipboard

Creates a unique name beginning with the specified prefix. Conflicts with node_group_name.

Link copied to clipboard
val nodeRoleArn: Output<String>

Amazon Resource Name (ARN) of the IAM Role that provides permissions for the EKS Node Group.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val releaseVersion: Output<String>

AMI version of the EKS Node Group. Defaults to latest version for Kubernetes version.

Link copied to clipboard

Configuration block with remote access settings. Detailed below.

Link copied to clipboard

List of objects containing information about underlying resources.

Link copied to clipboard

Configuration block with scaling settings. Detailed below.

Link copied to clipboard
val status: Output<String>

Status of the EKS Node Group.

Link copied to clipboard
val subnetIds: Output<List<String>>

Identifiers of EC2 Subnets to associate with the EKS Node Group. These subnets must have the following resource tag: kubernetes.io/cluster/CLUSTER_NAME (where CLUSTER_NAME is replaced with the name of the EKS Cluster). The following arguments are optional:

Link copied to clipboard
val tags: Output<Map<String, String>>?

Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Link copied to clipboard
val tagsAll: Output<Map<String, String>>

A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Link copied to clipboard
val taints: Output<List<NodeGroupTaint>>?

The Kubernetes taints to be applied to the nodes in the node group. Maximum of 50 taints per node group. Detailed below.

Link copied to clipboard
Link copied to clipboard
val urn: Output<String>
Link copied to clipboard
val version: Output<String>

Kubernetes version. Defaults to EKS Cluster Kubernetes version. The provider will only perform drift detection if a configuration value is provided.