-
Notifications
You must be signed in to change notification settings - Fork 83
/
Copy pathindex.ts
86 lines (77 loc) · 2.31 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import * as awsx from "@pulumi/awsx";
import * as eks from "@pulumi/eks";
import * as iam from "./iam";
// IAM roles for the node groups.
const role0 = iam.createRole("example-role0");
const role1 = iam.createRole("example-role1");
const role2 = iam.createRole("example-role2");
// Create a new VPC
const eksVpc = new awsx.ec2.Vpc("eks-vpc", {
enableDnsHostnames: true,
cidrBlock: "10.0.0.0/16",
});
// Create an EKS cluster.
const cluster = new eks.Cluster("example-managed-nodegroups", {
skipDefaultNodeGroup: true,
vpcId: eksVpc.vpcId,
// Public subnets will be used for load balancers
publicSubnetIds: eksVpc.publicSubnetIds,
// Private subnets will be used for cluster nodes
privateSubnetIds: eksVpc.privateSubnetIds,
instanceRoles: [role0, role1, role2],
});
// Export the cluster's kubeconfig.
export const kubeconfig = cluster.kubeconfig;
// Create a simple AWS managed node group using a cluster as input and the
// refactored API.
const managedNodeGroup0 = eks.createManagedNodeGroup("example-managed-ng0", {
cluster: cluster,
nodeRole: role0,
kubeletExtraArgs: "--max-pods=500",
enableIMDSv2: true,
});
// Create a simple AWS managed node group using a cluster as input and the
// initial API.
const managedNodeGroup1 = eks.createManagedNodeGroup(
"example-managed-ng1",
{
cluster: cluster,
nodeGroupName: "aws-managed-ng1",
nodeRoleArn: role1.arn,
},
cluster
);
// Create an explicit AWS managed node group using a cluster as input and the
// initial API.
const managedNodeGroup2 = eks.createManagedNodeGroup(
"example-managed-ng2",
{
cluster: cluster,
nodeGroupName: "aws-managed-ng2",
nodeRoleArn: role2.arn,
scalingConfig: {
desiredSize: 1,
minSize: 1,
maxSize: 2,
},
diskSize: 20,
instanceTypes: ["t3.medium"],
labels: { ondemand: "true" },
tags: { org: "pulumi" },
},
cluster
);
// Create a simple AWS managed node group with IMDSv2 enabled
const managedNodeGroup3 = new eks.ManagedNodeGroup("example-managed-ng3", {
cluster: cluster,
nodeRole: role2,
enableIMDSv2: true,
});
// Node Group with graviton instances
const managedNodeGroup4 = eks.createManagedNodeGroup("example-managed-ng4", {
cluster: cluster,
nodeRole: role0,
kubeletExtraArgs: "--max-pods=500",
enableIMDSv2: true,
instanceTypes: ["t4g.medium"],
});