CreateFargateProfile
Creates an AWS Fargate profile for your Amazon EKS cluster. You must have at least one Fargate profile in a cluster to be able to run pods on Fargate.
The Fargate profile allows an administrator to declare which pods run on Fargate and specify which pods run on which Fargate profile. This declaration is done through the profile’s selectors. Each profile can have up to five selectors that contain a namespace and labels. A namespace is required for every selector. The label field consists of multiple optional key-value pairs. Pods that match the selectors are scheduled on Fargate. If a to-be-scheduled pod matches any of the selectors in the Fargate profile, then that pod is run on Fargate.
When you create a Fargate profile, you must specify a pod execution
role to use with the pods that are scheduled with the profile. This role is added to the
cluster's Kubernetes Role Based
Access Controlkubelet
that is running on the Fargate infrastructure can register with your
Amazon EKS cluster so that it can appear in your cluster as a node. The pod
execution role also provides IAM permissions to the Fargate infrastructure to allow read access to Amazon ECR image repositories. For
more information, see Pod Execution Role in the Amazon EKS User Guide.
Fargate profiles are immutable. However, you can create a new updated profile to replace an existing profile and then delete the original after the updated profile has finished creating.
If any Fargate profiles in a cluster are in the DELETING
status, you must wait for that Fargate profile to finish deleting before
you can create any other profiles in that cluster.
For more information, see AWS Fargate profile in the Amazon EKS User Guide.
Request Syntax
POST /clusters/name
/fargate-profiles HTTP/1.1
Content-type: application/json
{
"clientRequestToken": "string
",
"fargateProfileName": "string
",
"podExecutionRoleArn": "string
",
"selectors": [
{
"labels": {
"string
" : "string
"
},
"namespace": "string
"
}
],
"subnets": [ "string
" ],
"tags": {
"string
" : "string
"
}
}
URI Request Parameters
The request uses the following URI parameters.
- name
-
The name of your cluster.
Required: Yes
Request Body
The request accepts the following data in JSON format.
- clientRequestToken
-
A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.
Type: String
Required: No
- fargateProfileName
-
The name of the Fargate profile.
Type: String
Required: Yes
- podExecutionRoleArn
-
The Amazon Resource Name (ARN) of the
Pod
execution role to use for aPod
that matches the selectors in the Fargate profile. ThePod
execution role allows Fargate infrastructure to register with your cluster as a node, and it provides read access to Amazon ECR image repositories. For more information, seePod
execution role in the Amazon EKS User Guide.Type: String
Required: Yes
- selectors
-
The selectors to match for a
Pod
to use this Fargate profile. Each selector must have an associated Kubernetesnamespace
. Optionally, you can also specifylabels
for anamespace
. You may specify up to five selectors in a Fargate profile.Type: Array of FargateProfileSelector objects
Required: No
- subnets
-
The IDs of subnets to launch a
Pod
into. APod
running on Fargate isn't assigned a public IP address, so only private subnets (with no direct route to an Internet Gateway) are accepted for this parameter.Type: Array of strings
Required: No
-
Metadata that assists with categorization and organization. Each tag consists of a key and an optional value. You define both. Tags don't propagate to any other cluster or AWS resources.
Type: String to string map
Map Entries: Maximum number of 50 items.
Key Length Constraints: Minimum length of 1. Maximum length of 128.
Value Length Constraints: Maximum length of 256.
Required: No
Response Syntax
HTTP/1.1 200
Content-type: application/json
{
"fargateProfile": {
"clusterName": "string",
"createdAt": number,
"fargateProfileArn": "string",
"fargateProfileName": "string",
"health": {
"issues": [
{
"code": "string",
"message": "string",
"resourceIds": [ "string" ]
}
]
},
"podExecutionRoleArn": "string",
"selectors": [
{
"labels": {
"string" : "string"
},
"namespace": "string"
}
],
"status": "string",
"subnets": [ "string" ],
"tags": {
"string" : "string"
}
}
}
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
The following data is returned in JSON format by the service.
- fargateProfile
-
The full description of your new Fargate profile.
Type: FargateProfile object
Errors
For information about the errors that are common to all actions, see Common Errors.
- ClientException
-
These errors are usually caused by a client action. Actions can include using an action or resource on behalf of an IAM principal that doesn't have permissions to use the action or resource or specifying an identifier that is not valid.
HTTP Status Code: 400
- InvalidParameterException
-
The specified parameter is invalid. Review the available parameters for the API request.
HTTP Status Code: 400
- InvalidRequestException
-
The request is invalid given the state of the cluster. Check the state of the cluster and the associated operations.
HTTP Status Code: 400
- ResourceLimitExceededException
-
You have encountered a service limit on the specified resource.
HTTP Status Code: 400
- ServerException
-
These errors are usually caused by a server-side issue.
HTTP Status Code: 500
- UnsupportedAvailabilityZoneException
-
At least one of your specified cluster subnets is in an Availability Zone that does not support Amazon EKS. The exception output specifies the supported Availability Zones for your account, from which you can choose subnets for your cluster.
HTTP Status Code: 400
Examples
In the following example or examples, the Authorization header contents
(AUTHPARAMS
) must be replaced with an AWS Signature Version 4
signature. For more information about creating these signatures, see Signature
Version 4 Signing Process in the Amazon EKS General
Reference.
You need to learn how to sign HTTP requests only if you intend to manually
create them. When you use the AWS Command Line
Interface (AWS CLI)
Example
The following example creates a Fargate profile called
default-with-infrastructure-label
in the fargate
cluster. Any Pod
launched in the default
namespace
with the Kubernetes label
"infrastructure": "fargate"
is run on Fargate.
Sample Request
POST /clusters/fargate/fargate-profiles HTTP/1.1
Host: eks.us-west-2.amazonaws.com
Accept-Encoding: identity
User-Agent: aws-cli/1.16.284 Python/3.7.5 Darwin/18.7.0 botocore/1.13.20
X-Amz-Date: 20191120T202529Z
Authorization: AUTHPARAMS
Content-Length: 355
{
"fargateProfileName": "default-with-infrastructure-label",
"podExecutionRoleArn": "arn:aws:iam::012345678910:role/AmazonEKSPodExecutionRole",
"subnets": [
"subnet-xxxxxxxxxxxxxxxxx",
"subnet-yyyyyyyyyyyyyyyyy"
],
"selectors": [
{
"namespace": "default",
"labels": {
"infrastructure": "fargate"
}
}
],
"clientRequestToken": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
Sample Response
HTTP/1.1 200 OK
Date: Wed, 20 Nov 2019 20:37:30 GMT
Content-Type: application/json
Content-Length: 610
x-amzn-RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx
x-amz-apigw-id: DeaRjFWPvHcFcXw=
X-Amzn-Trace-Id: Root=1-xxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxx
Connection: keep-alive
{
"fargateProfile": {
"fargateProfileName": "compute-label",
"fargateProfileArn": "arn:aws:eks:us-west-2:012345678910:fargateprofile/fargate/compute-label/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"clusterName": "fargate",
"createdAt": 1574206849.791,
"podExecutionRoleArn": "arn:aws:iam::012345678910:role/AmazonEKSPodExecutionRole",
"subnets": [
"subnet-xxxxxxxxxxxxxxxxx",
"subnet-yyyyyyyyyyyyyyyyy"
],
"selectors": [
{
"namespace": "kube-system",
"labels": {
"compute": "fargate"
}
}
],
"status": "CREATING",
"tags": {}
}
}
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: