stocky-spoon-28903
03/27/2019, 5:42 PMnodeSubnetIds
when you create it - if you put them in the same AZ the nodes will all end up therebusy-pizza-73563
03/27/2019, 5:45 PMstocky-spoon-28903
03/27/2019, 5:46 PMbusy-pizza-73563
03/27/2019, 5:46 PMstocky-spoon-28903
03/27/2019, 5:49 PMbusy-pizza-73563
03/27/2019, 6:04 PMeks.Cluster()
?stocky-spoon-28903
03/27/2019, 6:05 PMbusy-pizza-73563
03/27/2019, 6:07 PMzone
option in aws.ec2.Vpc()
either, though.lemon-spoon-91807
03/27/2019, 6:13 PM/**
* Nested argument for the VPC associated with your cluster. Amazon EKS VPC resources have specific requirements to work properly with Kubernetes. For more information, see [Cluster VPC Considerations](<https://docs.aws.amazon.com/eks/latest/userguide/network_reqs.html>) and [Cluster Security Group Considerations](<https://docs.aws.amazon.com/eks/latest/userguide/sec-group-reqs.html>) in the Amazon EKS User Guide. Configuration detailed below.
*/
public readonly vpcConfig: pulumi.Output<{ securityGroupIds?: string[], subnetIds: string[], vpcId: string }>;
Vpc.fromExistingIds(..., { vpcId: eksCluster.vpcConfig.vpcId })
busy-pizza-73563
03/27/2019, 6:18 PMlemon-spoon-91807
03/27/2019, 6:19 PMbusy-pizza-73563
03/27/2019, 6:23 PMlemon-spoon-91807
03/27/2019, 6:23 PMstocky-spoon-28903
03/27/2019, 6:24 PMeks.Cluster
on it’s own can create a VPC with a single subnet in a specified zonebusy-pizza-73563
03/27/2019, 6:24 PMstocky-spoon-28903
03/27/2019, 6:24 PMlemon-spoon-91807
03/27/2019, 6:25 PMstocky-spoon-28903
03/27/2019, 6:25 PMbusy-pizza-73563
03/27/2019, 6:25 PMstocky-spoon-28903
03/27/2019, 6:26 PMlemon-spoon-91807
03/27/2019, 6:26 PMstocky-spoon-28903
03/27/2019, 6:26 PMbusy-pizza-73563
03/27/2019, 6:26 PMzone
config in aws.ec2.Vpc()
.stocky-spoon-28903
03/27/2019, 6:26 PMlemon-spoon-91807
03/27/2019, 6:26 PMnumberOfAvailabilityZones=1
stocky-spoon-28903
03/27/2019, 6:27 PMaws.ec2.Subnet
though (it’s called availabilityZone
)lemon-spoon-91807
03/27/2019, 6:27 PMnumberOfAvailabilityZones
just affects how we partition all the subnetsbusy-pizza-73563
03/27/2019, 6:27 PMSubnet
to a Vpc
?stocky-spoon-28903
03/27/2019, 6:27 PMvpcId
on the subnetlemon-spoon-91807
03/27/2019, 6:28 PMbusy-pizza-73563
03/27/2019, 6:28 PMlemon-spoon-91807
03/27/2019, 6:28 PMbusy-pizza-73563
03/27/2019, 6:29 PMeks.Cluster()
now.stocky-spoon-28903
03/27/2019, 6:29 PMbusy-pizza-73563
03/27/2019, 6:29 PMconst cluster = new eks.Cluster('cluster', {
skipDefaultNodeGroup: true,
...
});
cluster.createNodeGroup('worker', {
...
});
lemon-spoon-91807
03/27/2019, 6:29 PMNo, I'm only usingnow.eks.Cluster()
busy-pizza-73563
03/27/2019, 6:30 PMnumOfAvailAbilityZones
in aws.ec2.Vpc()
.lemon-spoon-91807
03/27/2019, 6:30 PMbusy-pizza-73563
03/27/2019, 6:32 PMcluster.createNodeGroup()
, though?new eks.Cluster()
)lemon-spoon-91807
03/27/2019, 6:32 PMShouldn't that be an option to, though?cluster.createNodeGroup()
busy-pizza-73563
03/27/2019, 6:33 PMnumOfAvailAbilityZones
option.stocky-spoon-28903
03/27/2019, 6:34 PMlemon-spoon-91807
03/27/2019, 6:35 PM@pulumi/eks
very well. sorrybusy-pizza-73563
03/27/2019, 6:35 PMlemon-spoon-91807
03/27/2019, 6:35 PMbusy-pizza-73563
03/27/2019, 6:37 PMlemon-spoon-91807
03/27/2019, 6:37 PMbusy-pizza-73563
03/27/2019, 6:38 PMlemon-spoon-91807
03/27/2019, 6:39 PMbusy-pizza-73563
03/27/2019, 6:39 PMlemon-spoon-91807
03/27/2019, 6:39 PMbusy-pizza-73563
03/27/2019, 6:41 PMlemon-spoon-91807
03/27/2019, 6:41 PMbusy-pizza-73563
03/27/2019, 6:41 PMlemon-spoon-91807
03/27/2019, 6:42 PMbusy-pizza-73563
03/27/2019, 6:42 PMeks.Cluster()
is doing. 🙂lemon-spoon-91807
03/27/2019, 6:42 PMbusy-pizza-73563
03/27/2019, 6:43 PMlemon-spoon-91807
03/27/2019, 6:43 PMbusy-pizza-73563
03/27/2019, 6:44 PMlemon-spoon-91807
03/27/2019, 6:44 PM=1
we'll just always pick teh first AZ for that region.busy-pizza-73563
03/27/2019, 6:44 PMlemon-spoon-91807
03/27/2019, 6:45 PMbusy-pizza-73563
03/27/2019, 6:46 PMcreamy-potato-29402
03/27/2019, 6:47 PMbusy-pizza-73563
03/27/2019, 6:47 PMcreamy-potato-29402
03/27/2019, 6:47 PMbusy-pizza-73563
03/27/2019, 6:48 PMcreamy-potato-29402
03/27/2019, 6:49 PMbusy-pizza-73563
03/27/2019, 6:49 PMcreamy-potato-29402
03/27/2019, 6:49 PMbusy-pizza-73563
03/27/2019, 6:49 PMcreamy-potato-29402
03/27/2019, 6:53 PMlemon-spoon-91807
03/27/2019, 6:56 PMcreamy-potato-29402
03/27/2019, 6:56 PMlemon-spoon-91807
03/27/2019, 6:56 PMcreamy-potato-29402
03/27/2019, 6:57 PMlemon-spoon-91807
03/27/2019, 6:59 PMbusy-pizza-73563
03/27/2019, 7:24 PMcreamy-potato-29402
03/27/2019, 7:24 PMbusy-pizza-73563
03/27/2019, 7:25 PMcreamy-potato-29402
03/27/2019, 7:25 PMlemon-spoon-91807
03/27/2019, 7:25 PMbusy-pizza-73563
03/27/2019, 11:09 PMexport function getSubnetIdInAZ(cluster: eks.Cluster, az: string) {
const subnetIds = cluster.eksCluster.vpcConfig.subnetIds;
const index = subnetIds.apply(ids =>
Promise.all(
ids.map(id =>
aws.ec2.getSubnet({ id }).then(subnet => subnet.availabilityZone)
)
).then(azs => azs.indexOf(az))
);
return index.apply(index => subnetIds[index]);
}
lemon-spoon-91807
03/27/2019, 11:14 PMbusy-pizza-73563
03/27/2019, 11:16 PMcluster.createNodeGroup('worker', {
...
nodeSubnetIds: [getSubnetIdInAZ(cluster, 'eu-central-1c')],
}
ClusterNodeGroupOptions
. 🙂lemon-spoon-91807
03/27/2019, 11:18 PMbusy-pizza-73563
03/27/2019, 11:46 PMexport function getSubnetIdInAZ(cluster: eks.Cluster, az: string) {
const { subnetIds } = cluster.eksCluster.vpcConfig;
const index = subnetIds.apply(async ids => {
const availabilityZones = await Promise.all(
ids.map(async id => (await aws.ec2.getSubnet({ id })).availabilityZone)
);
return availabilityZones.indexOf(az);
});
return index.apply(index => subnetIds[index]);
}
export function getSubnetIdInAZ(cluster: eks.Cluster, az: string) {
const { subnetIds } = cluster.eksCluster.vpcConfig;
return subnetIds.apply(async ids => {
const subnets = await Promise.all(ids.map(id => aws.ec2.getSubnet({ id })));
const subnet = subnets.find(subnet => subnet.availabilityZone === az);
if (!subnet) {
throw new Error(`No subnet found in ${az} zone`);
}
return subnet.id;
});
}
stocky-spoon-28903
03/28/2019, 12:11 AMbusy-pizza-73563
03/28/2019, 12:13 AMstocky-spoon-28903
03/28/2019, 12:14 AMbusy-pizza-73563
03/28/2019, 12:35 AMstocky-spoon-28903
03/28/2019, 12:42 AMbusy-pizza-73563
04/01/2019, 2:12 PM