FargateProfile
Fargate profiles allows an administrator to declare which pods run on Fargate.
This declaration is done through the profile’s selectors. Each profile can have up to five selectors that contain a namespace and optional labels. You must define a namespace for every selector. The label field consists of multiple optional key-value pairs. Pods that match a selector (by matching a namespace for the selector and all of the labels specified in the selector) are scheduled on Fargate. If a namespace selector is defined without any labels, Amazon EKS will attempt to schedule all pods that run in that namespace onto Fargate using the profile. If a to-be-scheduled pod matches any of the selectors in the Fargate profile, then that pod is scheduled on Fargate.
If a pod matches multiple Fargate profiles, Amazon EKS picks one of the matches at random. In this case, you can specify which profile a pod should use by adding the following Kubernetes label to the pod specification: eks.amazonaws.com/fargate-profile: profile_name. However, the pod must still match a selector in that profile in order to be scheduled onto Fargate.
Example
declare const cluster: eks.Cluster;
new eks.FargateProfile(this, 'MyProfile', {
cluster,
selectors: [ { namespace: 'default' } ],
});
# cluster: eks.Cluster
eks.FargateProfile(self, "MyProfile",
cluster=cluster,
selectors=[eks.Selector(namespace="default")]
)
Cluster cluster;
FargateProfile.Builder.create(this, "MyProfile")
.cluster(cluster)
.selectors(List.of(Selector.builder().namespace("default").build()))
.build();
// Install: dotnet add package Amazon.CDK.Lib
Cluster cluster;
new FargateProfile(this, "MyProfile", new FargateProfileProps {
Cluster = cluster,
Selectors = new [] { new Selector { Namespace = "default" } }
});
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var cluster Cluster
eks.NewFargateProfile(this, jsii.String("MyProfile"), &FargateProfileProps{
Cluster: Cluster,
Selectors: []Selector{
&Selector{
Namespace: jsii.String("default"),
},
},
})
Initializer
new FargateProfile(scope: Construct, id: string, props: FargateProfileProps)
FargateProfile(scope: Construct, id: str, props: FargateProfileProps)
new FargateProfile(Construct scope, String id, FargateProfileProps props)
new FargateProfile(Construct scope, string id, FargateProfileProps props)
NewFargateProfile(Scope Construct, Id *string, Props FargateProfileProps)
Construct Props
[disable-awslint:ref-via-interface]
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*[]Selectorrequired#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
Properties
fargateProfileArnstringfargate_profile_arnstrfargateProfileArnStringFargateProfileArnstringFargateProfileArn*string#fargateProfileNamestringfargate_profile_namestrfargateProfileNameStringFargateProfileNamestringFargateProfileName*string#podExecutionRoleIRolepod_execution_roleIRolepodExecutionRoleIRolePodExecutionRoleIRolePodExecutionRoleIRole#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.
Methods
isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#notes · 1 parameter · returns
Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.
Parameters
xxxxX— Any object.
Returns: true if x is an object created from a class which extends Construct.
toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.
1 parameter · returns
Parameters
mixinsmixinsmixinsmixinsMixins— The mixins to apply.
Returns: This construct for chaining