Amazon EKS
Design notes for running Celerity applications on Amazon EKS
Design notes
This target environment is part of the vision and is not available yet. These notes come from early research into how Celerity resource types are likely to work on it. They are kept as a reference for when it is implemented, and will change when it is.
Amazon EKS is envisioned as a containerised AWS target alongside Amazon ECS, selected with the aws deploy target and aws.compute.containerService set to eks. Infrastructure resource types work the same way as they do with Amazon ECS, so only the compute resource types are covered here.
celerity/api
When an API is first deployed to EKS, a new cluster is created for the API unless you specify an existing cluster to use in the deploy configuration.
Using existing clusters
When using an existing cluster, the cluster must be configured in a way that is compatible with the VPC annotations configured for the API as well as the target compute type.
For example, a cluster without a Fargate profile can not be used to deploy an API that is configured to use Fargate. Another example would be a cluster with a node group only associated with public subnets not being compatible with an API with the celerity.api.vpc.subnetType annotation set to private.
You also need to make sure there is enough memory and CPU allocated for node group instances to run the API in addition to other workloads running in the cluster.
Cost of running on EKS
Running a Celerity application on EKS will often not be the most cost-effective option for APIs with low traffic or applications that are not expected to use a lot of resources. All EKS clusters have a fixed cost of around $72 per month for cluster management (control plane etc.), in addition to the cost of the nodes (VMs) that are used to run the application pods along with cost of the load balancer, data transfer and networking components. If you are looking for a cost-effective solution for low-traffic/low-load applications on AWS, consider using Amazon ECS or switching to AWS Lambda instead.
The cluster is configured with a private endpoint for the Kubernetes API server by default, this can be overridden in the deploy configuration. (VPC links are required to access the Kubernetes API server with the default configuration)
For an EKS cluster backed by EC2, a node group is configured with auto-scaling configuration to have a minimum size of 2 nodes and a maximum size of 6 nodes by default for production app environments. For development app environments, the minimum size of a node group is 1 with a maximum size of 3 by default. Auto-scaling for the EC2 instances is handled by the Kubernetes Cluster Autoscaler. The instance type configured for node groups is determined by the CPU and memory requirements defined in the deploy configuration or derived from the handlers of the API, if the requirements can not be derived, a default instance type will be selected. For production app environments, the default instance type will be t3.medium with 2 vCPUs and 4GB of memory. For development app environments, the default instance type will be t3.small with 2 vCPUs and 2GB of memory.
For an EKS cluster backed by Fargate, a Fargate profile is configured to run the API.
The Kubernetes Horizontal Pod Autoscaler is used to scale the number of pods running the API based on CPU utilisation and average memory utilisation. In development app environments, the minimum number of pods is set to 1 and the maximum number of pods is set to 3 by default. In production app environments, the minimum number of pods is set to 2 and the maximum number of pods is set to 6 by default. The minimum and maximum number of pods can be overridden in the deploy configuration.
Once the cluster is up and running, Kubernetes services are provisioned to run the application, an Ingress service backed by an application load balancer is created to route traffic to the service, if you require private access to the API, the load balancer can be configured to be internal. When domain configuration is provided and the load balancer is public-facing, an ACM certificate is created for the domain and attached to the ingress service via annotations, you will need to verify the domain ownership before the certificate can be used.
When it comes to networking, EKS services need to be deployed to VPCs; if a VPC is defined in the blueprint and linked to the API, it will be used, otherwise the default VPC for the account will be used.
The ingress service backed by an application load balancer will be placed in the public subnet by default, but can be configured to be placed in a private subnet by setting the celerity.api.vpc.lbSubnetType annotation to private.
By default, 2 private subnets and 2 public subnets are provisioned for the associated VPC, the subnets are spread across 2 availability zones. For EC2-backed clusters, the EKS node group will be associated with all 4 subnets when celerity.api.vpc.subnetType is set to public; when celerity.api.vpc.subnetType is set to private, the node group will only be associated with the 2 private subnets. The orchestrator will take care of assigning one of the subnets defined for the node group.
For Fargate-backed clusters, the Fargate profile will be associated with the private subnets due to the limitations with Fargate profiles. For Fargate, the API will be deployed to one of the private subnets associated with the profile.
Warning
celerity.api.vpc.subnetType has no effect for Fargate-based EKS deployments, the API will always be deployed to a private subnet.
If memory and CPU is not defined in the deploy configuration and can not be derived from the handlers, some defaults will be set. For an EC2-backed cluster, the pod running the API is given resource requests and limits of just under 50 percent of a node's allocatable memory and 800m of CPU (0.8 vCPUs). Keeping each pod under half of a node leaves room for the kubelet and system pods such as kube-proxy and the VPC CNI. It also lets a new pod be scheduled alongside the old one during a rolling update, before the old pod is terminated. The exact memory usage values for the defaults would be 1,792MB for production app environments and 870MB for development app environments.
For a Fargate-backed cluster, in production app environments, the pod for the API is given resource requests of 2GB of memory and 0.5 vCPUs. In development app environments, the pod for the API is given resource requests of 1GB of memory and 0.5 vCPUs. Fargate has a fixed set of CPU and memory configurations that can be used.
A sidecar ADOT collector container is deployed in the pod with the API to collect traces and metrics for the application, this will take up a small portion of the memory and CPU allocated to the API. Traces are only collected when tracing is enabled for the API.
celerity/handler
On Amazon EKS, handlers would be loaded into the Celerity runtime in a single process, as they are on Amazon ECS. Celerity runtime identifiers would map to the same Celerity runtime container images as on Amazon ECS, for both language and OS-only runtimes.
celerity/consumer
When a consumer application is first deployed to EKS, a new cluster is created for the application unless you specify an existing cluster to use in the deploy configuration.
Warning
When using an existing cluster, the cluster must be configured in a way that is compatible with the VPC annotations configured for the consumer as well as the target compute type.
For example, a cluster without a Fargate profile can not be used to deploy a consumer application that is configured to use Fargate. Another example would be a cluster with a node group only associated with public subnets not being compatible with a consumer application with the celerity.consumer.vpc.subnetType annotation set to private.
You also need to make sure there is enough memory and CPU allocated for node group instances to run the application in addition to other workloads running in the cluster.
Warning
Running a Celerity application on EKS will often not be the most cost-effective way to run consumer applications that are not expected to use a lot of resources. All EKS clusters have a fixed cost of $74 per month for the control plane, in addition to the cost of the EC2 instances or Fargate tasks that are used to run the application along with the cost of data transfer and networking components. If you are looking for a cost-effective solution for low-load applications on AWS, consider using ECS or switching to a serverless deployment instead.
The cluster is configured with a private endpoint for the Kubernetes API server by default, this can be overridden in the deploy configuration. (VPC links are required to access the Kubernetes API server with the default configuration)
For an EKS cluster backed by EC2, a node group is configured with auto-scaling configuration to have a minimum size of 2 nodes and a maximum size of 6 nodes by default for production app environments. For development app environments, the minimum size of a node group is 1 with a maximum size of 3 by default. Auto-scaling is handled by the Kubernetes Cluster Autoscaler. The instance type configured for node groups is determined by the CPU and memory requirements defined in the deploy configuration or derived from the handlers of the consumer application, if the requirements can not be derived, a default instance type will be selected. For production app environments, the default instance type will be t3.medium with 2 vCPUs and 4GB of memory. For development app environments, the default instance type will be t3.small with 2 vCPUs and 2GB of memory.
For an EKS cluster backed by Fargate, a Fargate profile is configured to run the consumer application.
The Kubernetes Horizontal Pod Autoscaler is used to scale the number of pods running the consumer application based on CPU utilisation and average memory utilisation. In development app environments, the minimum number of pods is set to 1 and the maximum number of pods is set to 3 by default. In production app environments, the minimum number of pods is set to 2 and the maximum number of pods is set to 6 by default. The minimum and maximum number of pods can be overridden in the deploy configuration.
Once the cluster is up and running, Kubernetes services are provisioned to run the application.
When it comes to networking, EKS services need to be deployed to VPCs; if a VPC is defined in the blueprint and linked to the consumer application, it will be used, otherwise the default VPC for the account will be used.
By default, 2 private subnets and 2 public subnets are provisioned for the associated VPC, the subnets are spread across 2 availability zones. For EC2-backed clusters, the EKS node group will be associated with all 4 subnets when celerity.consumer.vpc.subnetType is set to public; when celerity.consumer.vpc.subnetType is set to private, the node group will only be associated with the 2 private subnets. The orchestrator will take care of assigning one of the subnets defined for the node group.
For Fargate-backed clusters, the Fargate profile will be associated with the private subnets due to the limitations with Fargate profiles. For Fargate, the consumer application will be deployed to one of the private subnets associated with the profile.
Warning
celerity.consumer.vpc.subnetType has no effect for Fargate-based EKS deployments, the application will always be deployed to a private subnet.
If memory and CPU is not defined in the deploy configuration and can not be derived from the handlers, some defaults will be set. For an EC2-backed cluster, the containers that make up the service for the consumer application will be deployed with less than 50 percent of memory and 0.8 vCPUs. Less than half of the memory and CPU is allocated to a node that will host the containers to allow for smooth deployments of new versions of the consumer application, this is done by making sure there is enough memory and CPU available to the Kubernetes agents. The exact memory usage values for the defaults would be 1,792MB for production app environments and 870MB for development app environments.
For a Fargate-backed cluster, in production app environments, the pod for the application will be deployed with 2GB of memory and 0.5 vCPUs. In development app environments, the pod for the application will be deployed with 1GB of memory and 0.5 vCPUs. Fargate has a fixed set of CPU and memory configurations that can be used.
A sidecar ADOT collector container is deployed in the pod with the consumer application to collect traces and metrics for the application, this will take up a small portion of the memory and CPU allocated to the consumer. Traces are only collected when tracing is enabled for the consumer application.
celerity/schedule
When a schedule application is first deployed to EKS, a new cluster is created for the application unless you specify an existing cluster to use in the deploy configuration.
using existing clusters
When using an existing cluster, the cluster must be configured in a way that is compatible with the VPC annotations configured for the schedule application as well as the target compute type.
For example, a cluster without a Fargate profile can not be used to deploy a schedule application that is configured to use Fargate. Another example would be a cluster with a node group only associated with public subnets not being compatible with a schedule application with the celerity.schedule.vpc.subnetType annotation set to private.
You also need to make sure there is enough memory and CPU allocated for node group instances to run the application in addition to other workloads running in the cluster.
cost of running on EKS
Running a Celerity application on EKS will often not be the most cost-effective way to run schedule applications that are not expected to use a lot of resources. All EKS clusters have a fixed cost of $74 per month for the control plane, in addition to the cost of the EC2 instances or Fargate tasks that are used to run the application along with the cost of data transfer and networking components. If you are looking for a cost-effective solution for low-load applications on AWS, consider using ECS or switching to a serverless deployment instead.
The cluster is configured with a private endpoint for the Kubernetes API server by default, this can be overridden in the deploy configuration. (VPC links will be required to access the Kubernetes API server with the default configuration)
For an EKS cluster backed by EC2, a node group is configured with auto-scaling configuration to have a minimum size of 2 nodes and a maximum size of 6 nodes by default for production app environments. For development app environments, the minimum size of a node group is 1 with a maximum size of 3 by default. Auto-scaling is handled by the Kubernetes Cluster Autoscaler. The instance type configured for node groups is determined by the CPU and memory requirements defined in the deploy configuration or derived from the handlers of the schedule application, if the requirements can not be derived, a default instance type will be selected. For production app environments, the default instance type will be t3.medium with 2 vCPUs and 4GB of memory. For development app environments, the default instance type will be t3.small with 2 vCPUs and 2GB of memory.
For an EKS cluster backed by Fargate, a Fargate profile is configured to run the schedule application.
The Kubernetes Horizontal Pod Autoscaler is used to scale the number of pods running the schedule application based on CPU utilisation and average memory utilisation. In development app environments, the minimum number of pods is set to 1 and the maximum number of pods is set to 3 by default. In production app environments, the minimum number of pods is set to 2 and the maximum number of pods is set to 6 by default. The minimum and maximum number of pods can be overridden in the deploy configuration.
Once the cluster is up and running, Kubernetes services are provisioned to run the application.
When it comes to networking, EKS services need to be deployed to VPCs; if a VPC is defined in the blueprint and linked to the schedule application, it will be used, otherwise the default VPC for the account will be used.
By default, 2 private subnets and 2 public subnets are provisioned for the associated VPC, the subnets are spread across 2 availability zones. For EC2-backed clusters, the EKS node group will be associated with all 4 subnets when celerity.schedule.vpc.subnetType is set to public; when celerity.schedule.vpc.subnetType is set to private, the node group will only be associated with the 2 private subnets. The orchestrator will take care of assigning one of the subnets defined for the node group.
For Fargate-backed clusters, the Fargate profile will be associated with the private subnets due to the limitations with Fargate profiles. For Fargate, the schedule application will be deployed to one of the private subnets associated with the profile.
Warning
celerity.schedule.vpc.subnetType has no effect for Fargate-based EKS deployments, the application will always be deployed to a private subnet.
If memory and CPU is not defined in the deploy configuration and can not be derived from the handlers, some defaults will be set. For an EC2-backed cluster, the containers that make up the service for the schedule application will be deployed with less than 50 percent of memory and 0.8 vCPUs. Less than half of the memory and CPU is allocated to a node that will host the containers to allow for smooth deployments of new versions of the schedule application, this is done by making sure there is enough memory and CPU available to the Kubernetes agents. The exact memory usage values for the defaults would be 1,792MB for production app environments and 870MB for development app environments.
For a Fargate-backed cluster, in production app environments, the pod for the application will be deployed with 2GB of memory and 0.5 vCPUs. In development app environments, the pod for the application will be deployed with 1GB of memory and 0.5 vCPUs. Fargate has a fixed set of CPU and memory configurations that can be used.
A sidecar ADOT collector container is deployed in the pod with the application to collect traces and metrics for the application, this will take up a small portion of the memory and CPU allocated to the schedule application. Traces are only collected when tracing is enabled for the application.
celerity/vpc
On Amazon EKS, a VPC linked to a celerity/api, celerity/consumer or celerity/schedule would place the application component itself, as it does on Amazon ECS, rather than its handlers.
Compute Configuration
These options would be set in the deployTarget.config object in the app deploy configuration file for the aws target, with aws.compute.containerService set to eks. They apply to every compute resource type: celerity/api, celerity/consumer, celerity/schedule and celerity/workflow. The options shared with Amazon ECS, such as aws.compute.launchType and aws.compute.instanceType, are documented on the compute configuration page.
aws.compute.eks.hpa.minReplicas
The minimum number of replicas of a pod that should be running at any time
for the Kubernetes horizontal pod autoscaler.
This is used when deploying to the aws target environment and the container service is eks.
Type
number
Deploy Targets
aws
Default Value
By default, this will be 1 for development app environments and 2 for production app environments.
Example
{
"deployTarget": {
"name": "aws",
"appEnv": "production",
"config": {
"aws.compute.eks.hpa.minReplicas": 2
}
}
}aws.compute.eks.hpa.maxReplicas
The maximum number of replicas of a pod that should be running at any time
for the Kubernetes horizontal pod autoscaler.
This is used when deploying to the aws target environment and the container service is eks.
Type
number
Deploy Targets
aws
Default Value
By default, this will be 3 for development app environments and 6 for production app environments.
Example
{
"deployTarget": {
"name": "aws",
"appEnv": "production",
"config": {
"aws.compute.eks.hpa.maxReplicas": 5
}
}
}aws.compute.eks.hpa.targetCPUUtilizationPercentage
The target CPU utilisation percentage for the Kubernetes horizontal pod autoscaler. This will be used in forming the scaling policy for pods running the application.
If aws.compute.eks.hpa.targetCPUAverageValue is also set, this value will take precedence.
This is used when deploying to the aws target environment and the container service is eks.
Type
number
Deploy Targets
aws
Default Value
By default, this will be 50 (percent) for both development and production app environments.
Example
{
"deployTarget": {
"name": "aws",
"appEnv": "production",
"config": {
"aws.compute.eks.hpa.targetCPUUtilizationPercentage": 45
}
}
}aws.compute.eks.hpa.targetCPUAverageValue
The target CPU exact average value for the Kubernetes horizontal pod autoscaler. This will be used in forming the scaling policy for pods running the application.
If aws.compute.eks.hpa.targetCPUUtilizationPercentage is also set, this value will be ignored.
This is used when deploying to the aws target environment and the container service is eks.
Type
string
Deploy Targets
aws
Default Value
If not set, this will not be used, a utilisation percentage will be used instead.
Example
{
"deployTarget": {
"name": "aws",
"appEnv": "production",
"config": {
"aws.compute.eks.hpa.targetCPUAverageValue": "1000m"
}
}
}aws.compute.eks.hpa.targetMemoryUtilizationPercentage
The target memory utilisation percentage for the Kubernetes horizontal pod autoscaler.
This will be used in forming the scaling policy for pods running the application.
If aws.compute.eks.hpa.targetMemoryAverageValue is also set, this value will take precedence.
This is used when deploying to the aws target environment and the container service is eks.
Type
number
Deploy Targets
aws
Default Value
By default, this will be 70 (percent) for both development and production app environments.
Example
{
"deployTarget": {
"name": "aws",
"appEnv": "production",
"config": {
"aws.compute.eks.hpa.targetMemoryUtilizationPercentage": 65
}
}
}aws.compute.eks.hpa.targetMemoryAverageValue
The target memory exact average value for the Kubernetes horizontal pod autoscaler.
This will be used in forming the scaling policy for pods running the application.
If aws.compute.eks.hpa.targetMemoryUtilizationPercentage is also set, this value will be ignored.
This is used when deploying to the aws target environment and the container service is eks.
Type
string
Deploy Targets
aws
Default Value
If not set, this will not be used, a utilisation percentage will be used instead.
Example
{
"deployTarget": {
"name": "aws",
"appEnv": "production",
"config": {
"aws.compute.eks.hpa.targetMemoryAverageValue": "2000Mi"
}
}
}aws.compute.eks.clusterAutoscaler.minNodes
The minimum number of nodes in the node group for your application running on EKS.
This is used when deploying to the aws target environment, the launch type is ec2 and the container service is eks.
Type
number
Deploy Targets
aws
Default Value
By default, this will be 1 for development app environments and 2 for production app environments.
Example
{
"deployTarget": {
"name": "aws",
"appEnv": "production",
"config": {
"aws.compute.eks.clusterAutoscaler.minNodes": 3
}
}
}aws.compute.eks.clusterAutoscaler.maxNodes
The maximum number of nodes in the node group for your application running on EKS.
This is used when deploying to the aws target environment, the launch type is ec2 and the container service is eks.
Type
number
Deploy Targets
aws
Default Value
By default, this will be 3 for development app environments and 6 for production app environments.
Example
{
"deployTarget": {
"name": "aws",
"appEnv": "production",
"config": {
"aws.compute.eks.clusterAutoscaler.maxNodes": 5
}
}
}aws.compute.eks.podMemory
The amount of memory that can be used by a single pod running the application.
This is used when deploying to the aws target environment and the container service is eks.
Type
string
Deploy Targets
aws
Default Value
If memory usage is set in the application blueprint for handlers in the application, these will be used to determine reasonable memory limits for pods instead.
If not set in the blueprint, by default, this will be 870Mi for development app environments and 1792Mi for production app environments.
Example
{
"deployTarget": {
"name": "aws",
"appEnv": "production",
"config": {
"aws.compute.eks.podMemory": "2Gi"
}
}
}aws.compute.eks.podCPU
The amount of CPU that can be used by a single pod running the application.
This is used when deploying to the aws target environment and the container service is eks.
Type
string
Deploy Targets
aws
Default Value
If CPU usage is set in the application blueprint for handlers in the application, these will be used to determine reasonable CPU limits for pods instead.
If not set in the blueprint, by default, this will be 0.8 for both production and development app environments.
Example
{
"deployTarget": {
"name": "aws",
"appEnv": "production",
"config": {
"aws.compute.eks.podCPU": "1"
}
}
}aws.compute.eks.apiserver
Details to connect to an existing Kubernetes cluster API server to deploy the application. Options for connecting to an existing cluster are not designed yet.
Last updated on