Skip to content

Cluster

Source: src/AWS/EKS/Cluster.ts

An Amazon EKS cluster with support for EKS Auto Mode settings.

Auto Mode Cluster (managed roles)

const cluster = yield* Cluster("AppCluster", {
compute: "auto",
resourcesVpcConfig: {
subnetIds: network.privateSubnetIds,
},
});

Auto Mode Cluster from Existing Roles and Subnets

const cluster = yield* Cluster("AppCluster", {
roleArn: clusterRole.roleArn,
resourcesVpcConfig: {
subnetIds: network.privateSubnetIds,
endpointPublicAccess: true,
endpointPrivateAccess: true,
},
accessConfig: {
authenticationMode: "API",
},
computeConfig: {
enabled: true,
nodeRoleArn: nodeRole.roleArn,
nodePools: ["system", "general-purpose"],
},
kubernetesNetworkConfig: {
elasticLoadBalancing: { enabled: true },
},
storageConfig: {
blockStorage: { enabled: true },
},
});
const cluster = yield* AWS.EKS.Cluster("AppCluster", {
roleArn: clusterRole.roleArn,
resourcesVpcConfig: { subnetIds: network.privateSubnetIds },
accessConfig: { authenticationMode: "API" },
});
const nodes = yield* AWS.EKS.Nodegroup("AppNodes", {
clusterName: cluster.clusterName,
nodeRole: nodeRole.roleArn,
subnets: network.privateSubnetIds,
instanceTypes: ["t3.medium"],
scalingConfig: { minSize: 1, maxSize: 2, desiredSize: 1 },
});
const metricsServer = yield* AWS.EKS.Addon("MetricsServer", {
clusterName: cluster.clusterName,
addonName: "metrics-server",
});