FargateProfile
- class aws_cdk.aws_eks.FargateProfile(scope, id, *, cluster, selectors, fargate_profile_name=None, pod_execution_role=None, subnet_selection=None, vpc=None)
Bases:
Construct
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.
- ExampleMetadata:
infused
Example:
# cluster: eks.Cluster eks.FargateProfile(self, "MyProfile", cluster=cluster, selectors=[eks.Selector(namespace="default")] )
- Parameters:
scope (
Construct
) –id (
str
) –cluster (
Cluster
) – The EKS cluster to apply the Fargate profile to. [disable-awslint:ref-via-interface]selectors (
Sequence
[Union
[Selector
,Dict
[str
,Any
]]]) – The selectors to match for pods to use this Fargate profile. 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.fargate_profile_name (
Optional
[str
]) – The name of the Fargate profile. Default: - generatedpod_execution_role (
Optional
[IRole
]) – The pod execution role to use for pods that match the selectors in the Fargate profile. 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. Default: - a role will be automatically createdsubnet_selection (
Union
[SubnetSelection
,Dict
[str
,Any
],None
]) – Select which subnets to launch your pods into. 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 Default: - all private subnets of the VPC are selected.vpc (
Optional
[IVpc
]) – The VPC from which to select subnets to launch your pods into. By default, all private subnets are selected. You can customize this usingsubnetSelection
. Default: - all private subnets used by the EKS cluster
Methods
- to_string()
Returns a string representation of this construct.
- Return type:
str
Attributes
- fargate_profile_arn
The full Amazon Resource Name (ARN) of the Fargate profile.
- Attribute:
true
- fargate_profile_name
The name of the Fargate profile.
- Attribute:
true
- node
The tree node.
- pod_execution_role
The pod execution role to use for pods that match the selectors in the Fargate profile.
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.
- tags
Resource tags.
Static Methods
- classmethod is_construct(x)
Checks if
x
is a construct.Use this method instead of
instanceof
to properly detectConstruct
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 classConstruct
in each copy of theconstructs
library is seen as a different class, and an instance of one class will not test asinstanceof
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 theconstructs
library can be accidentally installed, andinstanceof
will behave unpredictably. It is safest to avoid usinginstanceof
, and using this type-testing method instead.- Parameters:
x (
Any
) – Any object.- Return type:
bool
- Returns:
true if
x
is an object created from a class which extendsConstruct
.