FargateProfileOptions Struct
Options for defining EKS Fargate Profiles.
| Source | aws-eks-v2/lib/fargate-profile.ts |
|---|---|
| Type last changed |
Example
const cluster = new eks.Cluster(this, 'ManagedNodeCluster', {
version: eks.KubernetesVersion.V1_37,
defaultCapacityType: eks.DefaultCapacityType.NODEGROUP,
});
// Add a Fargate Profile for specific workloads (e.g., default namespace)
cluster.addFargateProfile('FargateProfile', {
selectors: [
{ namespace: 'default' }, // Run pods in 'default' on Fargate
],
});
cluster = eks.Cluster(self, "ManagedNodeCluster",
version=eks.KubernetesVersion.V1_37,
default_capacity_type=eks.DefaultCapacityType.NODEGROUP
)
# Add a Fargate Profile for specific workloads (e.g., default namespace)
cluster.add_fargate_profile("FargateProfile",
selectors=[eks.Selector(namespace="default")
]
)
Cluster cluster = Cluster.Builder.create(this, "ManagedNodeCluster")
.version(KubernetesVersion.V1_37)
.defaultCapacityType(DefaultCapacityType.NODEGROUP)
.build();
// Add a Fargate Profile for specific workloads (e.g., default namespace)
cluster.addFargateProfile("FargateProfile", FargateProfileOptions.builder()
.selectors(List.of(Selector.builder().namespace("default").build()))
.build());
// Install: dotnet add package Amazon.CDK.Lib
var cluster = new Cluster(this, "ManagedNodeCluster", new ClusterProps {
Version = KubernetesVersion.V1_37,
DefaultCapacityType = DefaultCapacityType.NODEGROUP
});
// Add a Fargate Profile for specific workloads (e.g., default namespace)
cluster.AddFargateProfile("FargateProfile", new FargateProfileOptions {
Selectors = new [] { new Selector { Namespace = "default" } }
});
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
cluster := eks.NewCluster(this, jsii.String("ManagedNodeCluster"), &ClusterProps{
Version: eks.KubernetesVersion_V1_37(),
DefaultCapacityType: eks.DefaultCapacityType_NODEGROUP,
})
// Add a Fargate Profile for specific workloads (e.g., default namespace)
cluster.AddFargateProfile(jsii.String("FargateProfile"), &FargateProfileOptions{
Selectors: []Selector{
&Selector{
Namespace: jsii.String("default"),
},
},
})
Properties
fargateProfileNameoptionalstringfargate_profile_nameoptionalstrfargateProfileNameoptionalStringFargateProfileNameoptionalstringFargateProfileNameoptional*string = generated #podExecutionRoleoptionalIRolepod_execution_roleoptionalIRolepodExecutionRoleoptionalIRolePodExecutionRoleoptionalIRolePodExecutionRoleoptionalIRole #Default: a role will be automatically created
The pod execution role allows Fargate infrastructure to register with your cluster as a node, and it provides read access to Amazon ECR image repositories.
removalPolicyoptionalRemovalPolicyremoval_policyoptionalRemovalPolicyremovalPolicyoptionalRemovalPolicyRemovalPolicyoptionalRemovalPolicyRemovalPolicyoptionalRemovalPolicy = RemovalPolicy.DESTROY #notes
The removal policy controls what happens to the resource if it stops being managed by CloudFormation. This can happen in one of three situations:
- The resource is removed from the template, so CloudFormation stops managing it
- A change to the resource is made that requires it to be replaced, so CloudFormation stops managing it
- The stack is deleted, so CloudFormation stops managing all resources in it
selectorsSelector[]selectorstyping.List[Selector]selectorsList<Selector>SelectorsSelector[]Selectors*[]Selector required #Each selector must have an associated namespace. Optionally, you can also specify labels for a namespace.
At least one selector is required and you may specify up to five selectors.
subnetSelectionoptionalSubnetSelectionsubnet_selectionoptionalSubnetSelectionsubnetSelectionoptionalSubnetSelectionSubnetSelectionoptionalSubnetSelectionSubnetSelectionoptionalSubnetSelection #Default: all private subnets of the VPC are selected.
At this time, pods running on Fargate are not assigned public IP addresses, so only private subnets (with no direct route to an Internet Gateway) are allowed.
You must specify the VPC to customize the subnet selection