Namespace Amazon.CDK.AWS.EKS
Amazon EKS Construct Library
---AWS CDK v1 has reached End-of-Support on 2023-06-01.
This package is no longer being updated, and users should migrate to AWS CDK v2.
For more information on how to migrate, see the Migrating to AWS CDK v2 guide.
This construct library allows you to define Amazon Elastic Container Service for Kubernetes (EKS) clusters. In addition, the library also supports defining Kubernetes resource manifests within EKS clusters.
Table Of Contents
Quick Start
This example defines an Amazon EKS cluster with the following configuration:
// provisiong a cluster
var cluster = new Cluster(this, "hello-eks", new ClusterProps {
Version = KubernetesVersion.V1_21
});
// apply a kubernetes manifest to the cluster
cluster.AddManifest("mypod", new Dictionary<string, object> {
{ "apiVersion", "v1" },
{ "kind", "Pod" },
{ "metadata", new Dictionary<string, string> { { "name", "mypod" } } },
{ "spec", new Dictionary<string, IDictionary<string, object>[]> {
{ "containers", new [] { new Struct {
Name = "hello",
Image = "paulbouwer/hello-kubernetes:1.5",
Ports = new [] { new Struct { ContainerPort = 8080 } }
} } }
} }
});
In order to interact with your cluster through kubectl
, you can use the aws eks update-kubeconfig
AWS CLI command
to configure your local kubeconfig. The EKS module will define a CloudFormation output in your stack which contains the command to run. For example:
Outputs:
ClusterConfigCommand43AAE40F = aws eks update-kubeconfig --name cluster-xxxxx --role-arn arn:aws:iam::112233445566:role/yyyyy
Execute the aws eks update-kubeconfig ...
command in your terminal to create or update a local kubeconfig context:
$ aws eks update-kubeconfig --name cluster-xxxxx --role-arn arn:aws:iam::112233445566:role/yyyyy
Added new context arn:aws:eks:rrrrr:112233445566:cluster/cluster-xxxxx to /home/boom/.kube/config
And now you can simply use kubectl
:
$ kubectl get all -n kube-system
NAME READY STATUS RESTARTS AGE
pod/aws-node-fpmwv 1/1 Running 0 21m
pod/aws-node-m9htf 1/1 Running 0 21m
pod/coredns-5cb4fb54c7-q222j 1/1 Running 0 23m
pod/coredns-5cb4fb54c7-v9nxx 1/1 Running 0 23m
...
Architectural Overview
The following is a qualitative diagram of the various possible components involved in the cluster deployment.
+-----------------------------------------------+ +-----------------+
| EKS Cluster | kubectl | |
|-----------------------------------------------|<-------------+| Kubectl Handler |
| | | |
| | +-----------------+
| +--------------------+ +-----------------+ |
| | | | | |
| | Managed Node Group | | Fargate Profile | | +-----------------+
| | | | | | | |
| +--------------------+ +-----------------+ | | Cluster Handler |
| | | |
+-----------------------------------------------+ +-----------------+
^ ^ +
| | |
| connect self managed capacity | | aws-sdk
| | create/update/delete |
+ | v
+--------------------+ + +-------------------+
| | --------------+| eks.amazonaws.com |
| Auto Scaling Group | +-------------------+
| |
+--------------------+
In a nutshell:
A more detailed breakdown of each is provided further down this README.
Provisioning clusters
Creating a new cluster is done using the Cluster
or FargateCluster
constructs. The only required property is the kubernetes version
.
new Cluster(this, "HelloEKS", new ClusterProps {
Version = KubernetesVersion.V1_21
});
You can also use FargateCluster
to provision a cluster that uses only fargate workers.
new FargateCluster(this, "HelloEKS", new FargateClusterProps {
Version = KubernetesVersion.V1_21
});
NOTE: Only 1 cluster per stack is supported. If you have a use-case for multiple clusters per stack, or would like to understand more about this limitation, see https://github.com/aws/aws-cdk/issues/10073.
Below you'll find a few important cluster configuration options. First of which is Capacity. Capacity is the amount and the type of worker nodes that are available to the cluster for deploying resources. Amazon EKS offers 3 ways of configuring capacity, which you can combine as you like:
Managed node groups
Amazon EKS managed node groups automate the provisioning and lifecycle management of nodes (Amazon EC2 instances) for Amazon EKS Kubernetes clusters. With Amazon EKS managed node groups, you don’t need to separately provision or register the Amazon EC2 instances that provide compute capacity to run your Kubernetes applications. You can create, update, or terminate nodes for your cluster with a single operation. Nodes run using the latest Amazon EKS optimized AMIs in your AWS account while node updates and terminations gracefully drain nodes to ensure that your applications stay available.
For more details visit <a href="https://docs.aws.amazon.com/eks/latest/userguide/managed-node-groups.html">Amazon EKS Managed Node Groups</a>.
Managed Node Groups are the recommended way to allocate cluster capacity.
By default, this library will allocate a managed node group with 2 m5.large instances (this instance type suits most common use-cases, and is good value for money).
At cluster instantiation time, you can customize the number of instances and their type:
new Cluster(this, "HelloEKS", new ClusterProps {
Version = KubernetesVersion.V1_21,
DefaultCapacity = 5,
DefaultCapacityInstance = InstanceType.Of(InstanceClass.M5, InstanceSize.SMALL)
});
To access the node group that was created on your behalf, you can use cluster.defaultNodegroup
.
Additional customizations are available post instantiation. To apply them, set the default capacity to 0, and use the cluster.addNodegroupCapacity
method:
var cluster = new Cluster(this, "HelloEKS", new ClusterProps {
Version = KubernetesVersion.V1_21,
DefaultCapacity = 0
});
cluster.AddNodegroupCapacity("custom-node-group", new NodegroupOptions {
InstanceTypes = new [] { new InstanceType("m5.large") },
MinSize = 4,
DiskSize = 100,
AmiType = NodegroupAmiType.AL2_X86_64_GPU
});
To set node taints, you can set taints
option.
Cluster cluster;
cluster.AddNodegroupCapacity("custom-node-group", new NodegroupOptions {
InstanceTypes = new [] { new InstanceType("m5.large") },
Taints = new [] { new TaintSpec {
Effect = TaintEffect.NO_SCHEDULE,
Key = "foo",
Value = "bar"
} }
});
Spot Instances Support
Use capacityType
to create managed node groups comprised of spot instances. To maximize the availability of your applications while using
Spot Instances, we recommend that you configure a Spot managed node group to use multiple instance types with the instanceTypes
property.
For more details visit <a href="https://docs.aws.amazon.com/eks/latest/userguide/managed-node-groups.html#managed-node-group-capacity-types">Managed node group capacity types</a>.
Cluster cluster;
cluster.AddNodegroupCapacity("extra-ng-spot", new NodegroupOptions {
InstanceTypes = new [] {
new InstanceType("c5.large"),
new InstanceType("c5a.large"),
new InstanceType("c5d.large") },
MinSize = 3,
CapacityType = CapacityType.SPOT
});
Launch Template Support
You can specify a launch template that the node group will use. For example, this can be useful if you want to use a custom AMI or add custom user data.
When supplying a custom user data script, it must be encoded in the MIME multi-part archive format, since Amazon EKS merges with its own user data. Visit the Launch Template Docs for mode details.
Cluster cluster;
var userData = @"MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=""==MYBOUNDARY==""
--==MYBOUNDARY==
Content-Type: text/x-shellscript; charset=""us-ascii""
#!/bin/bash
echo ""Running custom user data script""
--==MYBOUNDARY==--\
";
var lt = new CfnLaunchTemplate(this, "LaunchTemplate", new CfnLaunchTemplateProps {
LaunchTemplateData = new LaunchTemplateDataProperty {
InstanceType = "t3.small",
UserData = Fn.Base64(userData)
}
});
cluster.AddNodegroupCapacity("extra-ng", new NodegroupOptions {
LaunchTemplateSpec = new LaunchTemplateSpec {
Id = lt.Ref,
Version = lt.AttrLatestVersionNumber
}
});
Note that when using a custom AMI, Amazon EKS doesn't merge any user data. Which means you do not need the multi-part encoding. and are responsible for supplying the required bootstrap commands for nodes to join the cluster.
In the following example, /ect/eks/bootstrap.sh
from the AMI will be used to bootstrap the node.
Cluster cluster;
var userData = UserData.ForLinux();
userData.AddCommands("set -o xtrace", $"/etc/eks/bootstrap.sh {cluster.clusterName}");
var lt = new CfnLaunchTemplate(this, "LaunchTemplate", new CfnLaunchTemplateProps {
LaunchTemplateData = new LaunchTemplateDataProperty {
ImageId = "some-ami-id", // custom AMI
InstanceType = "t3.small",
UserData = Fn.Base64(userData.Render())
}
});
cluster.AddNodegroupCapacity("extra-ng", new NodegroupOptions {
LaunchTemplateSpec = new LaunchTemplateSpec {
Id = lt.Ref,
Version = lt.AttrLatestVersionNumber
}
});
You may specify one instanceType
in the launch template or multiple instanceTypes
in the node group, but not both.
For more details visit <a href="https://docs.aws.amazon.com/eks/latest/userguide/launch-templates.html">Launch Template Support</a>.
Graviton 2 instance types are supported including c6g
, m6g
, r6g
and t4g
.
Fargate profiles
AWS Fargate is a technology that provides on-demand, right-sized compute capacity for containers. With AWS Fargate, you no longer have to provision, configure, or scale groups of virtual machines to run containers. This removes the need to choose server types, decide when to scale your node groups, or optimize cluster packing.
You can control which pods start on Fargate and how they run with Fargate Profiles, which are defined as part of your Amazon EKS cluster.
See Fargate Considerations in the AWS EKS User Guide.
You can add Fargate Profiles to any EKS cluster defined in your CDK app
through the addFargateProfile()
method. The following example adds a profile
that will match all pods from the "default" namespace:
Cluster cluster;
cluster.AddFargateProfile("MyProfile", new FargateProfileOptions {
Selectors = new [] { new Selector { Namespace = "default" } }
});
You can also directly use the FargateProfile
construct to create profiles under different scopes:
Cluster cluster;
new FargateProfile(this, "MyProfile", new FargateProfileProps {
Cluster = cluster,
Selectors = new [] { new Selector { Namespace = "default" } }
});
To create an EKS cluster that only uses Fargate capacity, you can use FargateCluster
.
The following code defines an Amazon EKS cluster with a default Fargate Profile that matches all pods from the "kube-system" and "default" namespaces. It is also configured to run CoreDNS on Fargate.
var cluster = new FargateCluster(this, "MyCluster", new FargateClusterProps {
Version = KubernetesVersion.V1_21
});
FargateCluster
will create a default FargateProfile
which can be accessed via the cluster's defaultProfile
property. The created profile can also be customized by passing options as with addFargateProfile
.
NOTE: Classic Load Balancers and Network Load Balancers are not supported on pods running on Fargate. For ingress, we recommend that you use the ALB Ingress Controller on Amazon EKS (minimum version v1.1.4).
Self-managed nodes
Another way of allocating capacity to an EKS cluster is by using self-managed nodes. EC2 instances that are part of the auto-scaling group will serve as worker nodes for the cluster. This type of capacity is also commonly referred to as EC2 Capacity* or EC2 Nodes.
For a detailed overview please visit Self Managed Nodes.
Creating an auto-scaling group and connecting it to the cluster is done using the cluster.addAutoScalingGroupCapacity
method:
Cluster cluster;
cluster.AddAutoScalingGroupCapacity("frontend-nodes", new AutoScalingGroupCapacityOptions {
InstanceType = new InstanceType("t2.medium"),
MinCapacity = 3,
VpcSubnets = new SubnetSelection { SubnetType = SubnetType.PUBLIC }
});
To connect an already initialized auto-scaling group, use the cluster.connectAutoScalingGroupCapacity()
method:
Cluster cluster;
AutoScalingGroup asg;
cluster.ConnectAutoScalingGroupCapacity(asg, new AutoScalingGroupOptions { });
To connect a self-managed node group to an imported cluster, use the cluster.connectAutoScalingGroupCapacity()
method:
Cluster cluster;
AutoScalingGroup asg;
var importedCluster = Cluster.FromClusterAttributes(this, "ImportedCluster", new ClusterAttributes {
ClusterName = cluster.ClusterName,
ClusterSecurityGroupId = cluster.ClusterSecurityGroupId
});
importedCluster.ConnectAutoScalingGroupCapacity(asg, new AutoScalingGroupOptions { });
In both cases, the cluster security group will be automatically attached to the auto-scaling group, allowing for traffic to flow freely between managed and self-managed nodes.
Note: The default updateType
for auto-scaling groups does not replace existing nodes. Since security groups are determined at launch time, self-managed nodes that were provisioned with version 1.78.0
or lower, will not be updated.
To apply the new configuration on all your self-managed nodes, you'll need to replace the nodes using the UpdateType.REPLACING_UPDATE
policy for the updateType
property.
You can customize the /etc/eks/boostrap.sh script, which is responsible
for bootstrapping the node to the EKS cluster. For example, you can use kubeletExtraArgs
to add custom node labels or taints.
Cluster cluster;
cluster.AddAutoScalingGroupCapacity("spot", new AutoScalingGroupCapacityOptions {
InstanceType = new InstanceType("t3.large"),
MinCapacity = 2,
BootstrapOptions = new BootstrapOptions {
KubeletExtraArgs = "--node-labels foo=bar,goo=far",
AwsApiRetryAttempts = 5
}
});
To disable bootstrapping altogether (i.e. to fully customize user-data), set bootstrapEnabled
to false
.
You can also configure the cluster to use an auto-scaling group as the default capacity:
var cluster = new Cluster(this, "HelloEKS", new ClusterProps {
Version = KubernetesVersion.V1_21,
DefaultCapacityType = DefaultCapacityType.EC2
});
This will allocate an auto-scaling group with 2 m5.large instances (this instance type suits most common use-cases, and is good value for money).
To access the AutoScalingGroup
that was created on your behalf, you can use cluster.defaultCapacity
.
You can also independently create an AutoScalingGroup
and connect it to the cluster using the cluster.connectAutoScalingGroupCapacity
method:
Cluster cluster;
AutoScalingGroup asg;
cluster.ConnectAutoScalingGroupCapacity(asg, new AutoScalingGroupOptions { });
This will add the necessary user-data to access the apiserver and configure all connections, roles, and tags needed for the instances in the auto-scaling group to properly join the cluster.
Spot Instances
When using self-managed nodes, you can configure the capacity to use spot instances, greatly reducing capacity cost.
To enable spot capacity, use the spotPrice
property:
Cluster cluster;
cluster.AddAutoScalingGroupCapacity("spot", new AutoScalingGroupCapacityOptions {
SpotPrice = "0.1094",
InstanceType = new InstanceType("t3.large"),
MaxCapacity = 10
});
Spot instance nodes will be labeled with <code>lifecycle=Ec2Spot</code> and tainted with <code>PreferNoSchedule</code>.
The AWS Node Termination Handler DaemonSet
will be
installed from Amazon EKS Helm chart repository on these nodes.
The termination handler ensures that the Kubernetes control plane responds appropriately to events that
can cause your EC2 instance to become unavailable, such as EC2 maintenance events
and EC2 Spot interruptions and helps gracefully stop all pods running on spot nodes that are about to be
terminated.
Handler Version: <a href="https://github.com/aws/aws-node-termination-handler/releases/tag/v1.7.0">1.7.0</a>
Chart Version: 0.9.5
To disable the installation of the termination handler, set the spotInterruptHandler
property to false
. This applies both to addAutoScalingGroupCapacity
and connectAutoScalingGroupCapacity
.
Bottlerocket
Bottlerocket is a Linux-based open-source operating system that is purpose-built by Amazon Web Services for running containers on virtual machines or bare metal hosts.
Bottlerocket
is supported when using managed nodegroups or self-managed auto-scaling groups.
To create a Bottlerocket managed nodegroup:
Cluster cluster;
cluster.AddNodegroupCapacity("BottlerocketNG", new NodegroupOptions {
AmiType = NodegroupAmiType.BOTTLEROCKET_X86_64
});
The following example will create an auto-scaling group of 2 t3.small
Linux instances running with the Bottlerocket
AMI.
Cluster cluster;
cluster.AddAutoScalingGroupCapacity("BottlerocketNodes", new AutoScalingGroupCapacityOptions {
InstanceType = new InstanceType("t3.small"),
MinCapacity = 2,
MachineImageType = MachineImageType.BOTTLEROCKET
});
The specific Bottlerocket AMI variant will be auto selected according to the k8s version for the x86_64
architecture.
For example, if the Amazon EKS cluster version is 1.17
, the Bottlerocket AMI variant will be auto selected as
aws-k8s-1.17
behind the scene.
See <a href="https://github.com/bottlerocket-os/bottlerocket/blob/develop/README.md#variants">Variants</a> for more details.
Please note Bottlerocket does not allow to customize bootstrap options and bootstrapOptions
properties is not supported when you create the Bottlerocket
capacity.
For more details about Bottlerocket, see Bottlerocket FAQs and Bottlerocket Open Source Blog.
Endpoint Access
When you create a new cluster, Amazon EKS creates an endpoint for the managed Kubernetes API server that you use to communicate with your cluster (using Kubernetes management tools such as kubectl
)
By default, this API server endpoint is public to the internet, and access to the API server is secured using a combination of AWS Identity and Access Management (IAM) and native Kubernetes Role Based Access Control (RBAC).
You can configure the cluster endpoint access by using the endpointAccess
property:
var cluster = new Cluster(this, "hello-eks", new ClusterProps {
Version = KubernetesVersion.V1_21,
EndpointAccess = EndpointAccess.PRIVATE
});
The default value is eks.EndpointAccess.PUBLIC_AND_PRIVATE
. Which means the cluster endpoint is accessible from outside of your VPC, but worker node traffic and kubectl
commands issued by this library stay within your VPC.
Alb Controller
Some Kubernetes resources are commonly implemented on AWS with the help of the ALB Controller.
From the docs:
AWS Load Balancer Controller is a controller to help manage Elastic Load Balancers for a Kubernetes cluster.
To deploy the controller on your EKS cluster, configure the albController
property:
new Cluster(this, "HelloEKS", new ClusterProps {
Version = KubernetesVersion.V1_21,
AlbController = new AlbControllerOptions {
Version = AlbControllerVersion.V2_4_1
}
});
Querying the controller pods should look something like this:
❯ kubectl get pods -n kube-system
NAME READY STATUS RESTARTS AGE
aws-load-balancer-controller-76bd6c7586-d929p 1/1 Running 0 109m
aws-load-balancer-controller-76bd6c7586-fqxph 1/1 Running 0 109m
...
...
Every Kubernetes manifest that utilizes the ALB Controller is effectively dependant on the controller. If the controller is deleted before the manifest, it might result in dangling ELB/ALB resources. Currently, the EKS construct library does not detect such dependencies, and they should be done explicitly.
For example:
Cluster cluster;
var manifest = cluster.AddManifest("manifest", new Dictionary<string, object> { });
if (cluster.AlbController)
{
manifest.Node.AddDependency(cluster.AlbController);
}
VPC Support
You can specify the VPC of the cluster using the vpc
and vpcSubnets
properties:
Vpc vpc;
new Cluster(this, "HelloEKS", new ClusterProps {
Version = KubernetesVersion.V1_21,
Vpc = vpc,
VpcSubnets = new [] { new SubnetSelection { SubnetType = SubnetType.PRIVATE_WITH_NAT } }
});
Note: Isolated VPCs (i.e with no internet access) are not currently supported. See https://github.com/aws/aws-cdk/issues/12171
If you do not specify a VPC, one will be created on your behalf, which you can then access via cluster.vpc
. The cluster VPC will be associated to any EKS managed capacity (i.e Managed Node Groups and Fargate Profiles).
Please note that the vpcSubnets
property defines the subnets where EKS will place the control plane ENIs. To choose
the subnets where EKS will place the worker nodes, please refer to the Provisioning clusters section above.
If you allocate self managed capacity, you can specify which subnets should the auto-scaling group use:
Vpc vpc;
Cluster cluster;
cluster.AddAutoScalingGroupCapacity("nodes", new AutoScalingGroupCapacityOptions {
VpcSubnets = new SubnetSelection { Subnets = vpc.PrivateSubnets },
InstanceType = new InstanceType("t2.medium")
});
There are two additional components you might want to provision within the VPC.
Kubectl Handler
The KubectlHandler
is a Lambda function responsible to issuing kubectl
and helm
commands against the cluster when you add resource manifests to the cluster.
The handler association to the VPC is derived from the endpointAccess
configuration. The rule of thumb is: If the cluster VPC can be associated, it will be.
Breaking this down, it means that if the endpoint exposes private access (via EndpointAccess.PRIVATE
or EndpointAccess.PUBLIC_AND_PRIVATE
), and the VPC contains private subnets, the Lambda function will be provisioned inside the VPC and use the private subnets to interact with the cluster. This is the common use-case.
If the endpoint does not expose private access (via EndpointAccess.PUBLIC
) or the VPC does not contain private subnets, the function will not be provisioned within the VPC.
If your use-case requires control over the IAM role that the KubeCtl Handler assumes, a custom role can be passed through the ClusterProps (as kubectlLambdaRole
) of the EKS Cluster construct.
Cluster Handler
The ClusterHandler
is a set of Lambda functions (onEventHandler
, isCompleteHandler
) responsible for interacting with the EKS API in order to control the cluster lifecycle. To provision these functions inside the VPC, set the placeClusterHandlerInVpc
property to true
. This will place the functions inside the private subnets of the VPC based on the selection strategy specified in the vpcSubnets
property.
You can configure the environment of the Cluster Handler functions by specifying it at cluster instantiation. For example, this can be useful in order to configure an http proxy:
SecurityGroup proxyInstanceSecurityGroup;
var cluster = new Cluster(this, "hello-eks", new ClusterProps {
Version = KubernetesVersion.V1_21,
ClusterHandlerEnvironment = new Dictionary<string, string> {
{ "https_proxy", "http://proxy.myproxy.com" }
},
/**
* If the proxy is not open publicly, you can pass a security group to the
* Cluster Handler Lambdas so that it can reach the proxy.
*/
ClusterHandlerSecurityGroup = proxyInstanceSecurityGroup
});
Kubectl Support
The resources are created in the cluster by running kubectl apply
from a python lambda function.
By default, CDK will create a new python lambda function to apply your k8s manifests. If you want to use an existing kubectl provider function, for example with tight trusted entities on your IAM Roles - you can import the existing provider and then use the imported provider when importing the cluster:
var handlerRole = Role.FromRoleArn(this, "HandlerRole", "arn:aws:iam::123456789012:role/lambda-role");
var kubectlProvider = KubectlProvider.FromKubectlProviderAttributes(this, "KubectlProvider", new KubectlProviderAttributes {
FunctionArn = "arn:aws:lambda:us-east-2:123456789012:function:my-function:1",
KubectlRoleArn = "arn:aws:iam::123456789012:role/kubectl-role",
HandlerRole = handlerRole
});
var cluster = Cluster.FromClusterAttributes(this, "Cluster", new ClusterAttributes {
ClusterName = "cluster",
KubectlProvider = kubectlProvider
});
Environment
You can configure the environment of this function by specifying it at cluster instantiation. For example, this can be useful in order to configure an http proxy:
var cluster = new Cluster(this, "hello-eks", new ClusterProps {
Version = KubernetesVersion.V1_21,
KubectlEnvironment = new Dictionary<string, string> {
{ "http_proxy", "http://proxy.myproxy.com" }
}
});
Runtime
The kubectl handler uses kubectl
, helm
and the aws
CLI in order to
interact with the cluster. These are bundled into AWS Lambda layers included in
the @aws-cdk/lambda-layer-awscli
and @aws-cdk/lambda-layer-kubectl
modules.
You can specify a custom lambda.LayerVersion
if you wish to use a different
version of these tools. The handler expects the layer to include the following
three executables:
helm/helm
kubectl/kubectl
awscli/aws
See more information in the Dockerfile for @aws-cdk/lambda-layer-awscli and the Dockerfile for @aws-cdk/lambda-layer-kubectl.
var layer = new LayerVersion(this, "KubectlLayer", new LayerVersionProps {
Code = Code.FromAsset("layer.zip")
});
Now specify when the cluster is defined:
LayerVersion layer;
Vpc vpc;
var cluster1 = new Cluster(this, "MyCluster", new ClusterProps {
KubectlLayer = layer,
Vpc = vpc,
ClusterName = "cluster-name",
Version = KubernetesVersion.V1_21
});
// or
var cluster2 = Cluster.FromClusterAttributes(this, "MyCluster", new ClusterAttributes {
KubectlLayer = layer,
Vpc = vpc,
ClusterName = "cluster-name"
});
Memory
By default, the kubectl provider is configured with 1024MiB of memory. You can use the kubectlMemory
option to specify the memory size for the AWS Lambda function:
// or
Vpc vpc;
new Cluster(this, "MyCluster", new ClusterProps {
KubectlMemory = Size.Gibibytes(4),
Version = KubernetesVersion.V1_21
});
Cluster.FromClusterAttributes(this, "MyCluster", new ClusterAttributes {
KubectlMemory = Size.Gibibytes(4),
Vpc = vpc,
ClusterName = "cluster-name"
});
ARM64 Support
Instance types with ARM64
architecture are supported in both managed nodegroup and self-managed capacity. Simply specify an ARM64 instanceType
(such as m6g.medium
), and the latest
Amazon Linux 2 AMI for ARM64 will be automatically selected.
Cluster cluster;
// add a managed ARM64 nodegroup
cluster.AddNodegroupCapacity("extra-ng-arm", new NodegroupOptions {
InstanceTypes = new [] { new InstanceType("m6g.medium") },
MinSize = 2
});
// add a self-managed ARM64 nodegroup
cluster.AddAutoScalingGroupCapacity("self-ng-arm", new AutoScalingGroupCapacityOptions {
InstanceType = new InstanceType("m6g.medium"),
MinCapacity = 2
});
Masters Role
When you create a cluster, you can specify a mastersRole
. The Cluster
construct will associate this role with the system:masters
RBAC group, giving it super-user access to the cluster.
Role role;
new Cluster(this, "HelloEKS", new ClusterProps {
Version = KubernetesVersion.V1_21,
MastersRole = role
});
If you do not specify it, a default role will be created on your behalf, that can be assumed by anyone in the account with sts:AssumeRole
permissions for this role.
This is the role you see as part of the stack outputs mentioned in the Quick Start.
$ aws eks update-kubeconfig --name cluster-xxxxx --role-arn arn:aws:iam::112233445566:role/yyyyy
Added new context arn:aws:eks:rrrrr:112233445566:cluster/cluster-xxxxx to /home/boom/.kube/config
Encryption
When you create an Amazon EKS cluster, envelope encryption of Kubernetes secrets using the AWS Key Management Service (AWS KMS) can be enabled. The documentation on creating a cluster can provide more details about the customer master key (CMK) that can be used for the encryption.
You can use the secretsEncryptionKey
to configure which key the cluster will use to encrypt Kubernetes secrets. By default, an AWS Managed key will be used.
This setting can only be specified when the cluster is created and cannot be updated.
var secretsKey = new Key(this, "SecretsKey");
var cluster = new Cluster(this, "MyCluster", new ClusterProps {
SecretsEncryptionKey = secretsKey,
Version = KubernetesVersion.V1_21
});
You can also use a similar configuration for running a cluster built using the FargateCluster construct.
var secretsKey = new Key(this, "SecretsKey");
var cluster = new FargateCluster(this, "MyFargateCluster", new FargateClusterProps {
SecretsEncryptionKey = secretsKey,
Version = KubernetesVersion.V1_21
});
The Amazon Resource Name (ARN) for that CMK can be retrieved.
Cluster cluster;
var clusterEncryptionConfigKeyArn = cluster.ClusterEncryptionConfigKeyArn;
Permissions and Security
Amazon EKS provides several mechanism of securing the cluster and granting permissions to specific IAM users and roles.
AWS IAM Mapping
As described in the Amazon EKS User Guide, you can map AWS IAM users and roles to Kubernetes Role-based access control (RBAC).
The Amazon EKS construct manages the aws-auth ConfigMap
Kubernetes resource on your behalf and exposes an API through the cluster.awsAuth
for mapping
users, roles and accounts.
Furthermore, when auto-scaling group capacity is added to the cluster, the IAM instance role of the auto-scaling group will be automatically mapped to RBAC so nodes can connect to the cluster. No manual mapping is required.
For example, let's say you want to grant an IAM user administrative privileges on your cluster:
Cluster cluster;
var adminUser = new User(this, "Admin");
cluster.AwsAuth.AddUserMapping(adminUser, new AwsAuthMapping { Groups = new [] { "system:masters" } });
A convenience method for mapping a role to the system:masters
group is also available:
Cluster cluster;
Role role;
cluster.AwsAuth.AddMastersRole(role);
Cluster Security Group
When you create an Amazon EKS cluster, a cluster security group is automatically created as well. This security group is designed to allow all traffic from the control plane and managed node groups to flow freely between each other.
The ID for that security group can be retrieved after creating the cluster.
Cluster cluster;
var clusterSecurityGroupId = cluster.ClusterSecurityGroupId;
Node SSH Access
If you want to be able to SSH into your worker nodes, you must already have an SSH key in the region you're connecting to and pass it when you add capacity to the cluster. You must also be able to connect to the hosts (meaning they must have a public IP and you should be allowed to connect to them on port 22):
See SSH into nodes for a code example.
If you want to SSH into nodes in a private subnet, you should set up a bastion host in a public subnet. That setup is recommended, but is unfortunately beyond the scope of this documentation.
Service Accounts
With services account you can provide Kubernetes Pods access to AWS resources.
Cluster cluster;
// add service account
var serviceAccount = cluster.AddServiceAccount("MyServiceAccount");
var bucket = new Bucket(this, "Bucket");
bucket.GrantReadWrite(serviceAccount);
var mypod = cluster.AddManifest("mypod", new Dictionary<string, object> {
{ "apiVersion", "v1" },
{ "kind", "Pod" },
{ "metadata", new Dictionary<string, string> { { "name", "mypod" } } },
{ "spec", new Dictionary<string, object> {
{ "serviceAccountName", serviceAccount.ServiceAccountName },
{ "containers", new [] { new Struct {
Name = "hello",
Image = "paulbouwer/hello-kubernetes:1.5",
Ports = new [] { new Struct { ContainerPort = 8080 } }
} } }
} }
});
// create the resource after the service account.
mypod.Node.AddDependency(serviceAccount);
// print the IAM role arn for this service account
// print the IAM role arn for this service account
new CfnOutput(this, "ServiceAccountIamRole", new CfnOutputProps { Value = serviceAccount.Role.RoleArn });
Note that using serviceAccount.serviceAccountName
above does not translate into a resource dependency.
This is why an explicit dependency is needed. See https://github.com/aws/aws-cdk/issues/9910 for more details.
It is possible to pass annotations and labels to the service account.
Cluster cluster;
// add service account with annotations and labels
var serviceAccount = cluster.AddServiceAccount("MyServiceAccount", new ServiceAccountOptions {
Annotations = new Dictionary<string, string> {
{ "eks.amazonaws.com/sts-regional-endpoints", "false" }
},
Labels = new Dictionary<string, string> {
{ "some-label", "with-some-value" }
}
});
You can also add service accounts to existing clusters.
To do so, pass the openIdConnectProvider
property when you import the cluster into the application.
// or create a new one using an existing issuer url
string issuerUrl;
// you can import an existing provider
var provider = OpenIdConnectProvider.FromOpenIdConnectProviderArn(this, "Provider", "arn:aws:iam::123456:oidc-provider/oidc.eks.eu-west-1.amazonaws.com/id/AB123456ABC");
var provider2 = new OpenIdConnectProvider(this, "Provider", new OpenIdConnectProviderProps {
Url = issuerUrl
});
var cluster = Cluster.FromClusterAttributes(this, "MyCluster", new ClusterAttributes {
ClusterName = "Cluster",
OpenIdConnectProvider = provider,
KubectlRoleArn = "arn:aws:iam::123456:role/service-role/k8sservicerole"
});
var serviceAccount = cluster.AddServiceAccount("MyServiceAccount");
var bucket = new Bucket(this, "Bucket");
bucket.GrantReadWrite(serviceAccount);
Note that adding service accounts requires running kubectl
commands against the cluster.
This means you must also pass the kubectlRoleArn
when importing the cluster.
See Using existing Clusters.
Applying Kubernetes Resources
The library supports several popular resource deployment mechanisms, among which are:
Kubernetes Manifests
The KubernetesManifest
construct or cluster.addManifest
method can be used
to apply Kubernetes resource manifests to this cluster.
When using <code>cluster.addManifest</code>, the manifest construct is defined within the cluster's stack scope. If the manifest contains
attributes from a different stack which depend on the cluster stack, a circular dependency will be created and you will get a synth time error.
To avoid this, directly use <code>new KubernetesManifest</code> to create the manifest in the scope of the other stack.
The following examples will deploy the paulbouwer/hello-kubernetes service on the cluster:
Cluster cluster;
IDictionary<string, string> appLabel = new Dictionary<string, string> { { "app", "hello-kubernetes" } };
IDictionary<string, object> deployment = new Dictionary<string, object> {
{ "apiVersion", "apps/v1" },
{ "kind", "Deployment" },
{ "metadata", new Dictionary<string, string> { { "name", "hello-kubernetes" } } },
{ "spec", new Dictionary<string, object> {
{ "replicas", 3 },
{ "selector", new Dictionary<string, IDictionary<string, string>> { { "matchLabels", appLabel } } },
{ "template", new Dictionary<string, IDictionary<string, IDictionary<string, string>>> {
{ "metadata", new Dictionary<string, IDictionary<string, string>> { { "labels", appLabel } } },
{ "spec", new Dictionary<string, IDictionary<string, object>[]> {
{ "containers", new [] { new Dictionary<string, object> {
{ "name", "hello-kubernetes" },
{ "image", "paulbouwer/hello-kubernetes:1.5" },
{ "ports", new [] { new Dictionary<string, int> { { "containerPort", 8080 } } } }
} } }
} }
} }
} }
};
IDictionary<string, object> service = new Dictionary<string, object> {
{ "apiVersion", "v1" },
{ "kind", "Service" },
{ "metadata", new Dictionary<string, string> { { "name", "hello-kubernetes" } } },
{ "spec", new Dictionary<string, object> {
{ "type", "LoadBalancer" },
{ "ports", new [] { new Dictionary<string, int> { { "port", 80 }, { "targetPort", 8080 } } } },
{ "selector", appLabel }
} }
};
// option 1: use a construct
// option 1: use a construct
new KubernetesManifest(this, "hello-kub", new KubernetesManifestProps {
Cluster = cluster,
Manifest = new [] { deployment, service }
});
// or, option2: use `addManifest`
cluster.AddManifest("hello-kub", service, deployment);
ALB Controller Integration
The KubernetesManifest
construct can detect ingress resources inside your manifest and automatically add the necessary annotations
so they are picked up by the ALB Controller.
See <a href="#alb-controller">Alb Controller</a>
To that end, it offers the following properties:
Adding resources from a URL
The following example will deploy the resource manifest hosting on remote server:
// This example is only available in TypeScript
import * as yaml from 'js-yaml';
import * as request from 'sync-request';
declare const cluster: eks.Cluster;
const manifestUrl = 'https://url/of/manifest.yaml';
const manifest = yaml.safeLoadAll(request('GET', manifestUrl).getBody());
cluster.addManifest('my-resource', manifest);
Dependencies
There are cases where Kubernetes resources must be deployed in a specific order. For example, you cannot define a resource in a Kubernetes namespace before the namespace was created.
You can represent dependencies between KubernetesManifest
s using
resource.node.addDependency()
:
Cluster cluster;
var namespace = cluster.AddManifest("my-namespace", new Dictionary<string, object> {
{ "apiVersion", "v1" },
{ "kind", "Namespace" },
{ "metadata", new Dictionary<string, string> { { "name", "my-app" } } }
});
var service = cluster.AddManifest("my-service", new Dictionary<string, object> {
{ "metadata", new Dictionary<string, string> {
{ "name", "myservice" },
{ "namespace", "my-app" }
} },
{ "spec", new Dictionary<string, object> { } }
});
service.Node.AddDependency(namespace);
NOTE: when a KubernetesManifest
includes multiple resources (either directly
or through cluster.addManifest()
) (e.g. cluster.addManifest('foo', r1, r2, r3,...)
), these resources will be applied as a single manifest via kubectl
and will be applied sequentially (the standard behavior in kubectl
).
Since Kubernetes manifests are implemented as CloudFormation resources in the
CDK. This means that if the manifest is deleted from your code (or the stack is
deleted), the next cdk deploy
will issue a kubectl delete
command and the
Kubernetes resources in that manifest will be deleted.
Resource Pruning
When a resource is deleted from a Kubernetes manifest, the EKS module will
automatically delete these resources by injecting a prune label to all
manifest resources. This label is then passed to kubectl apply --prune
.
Pruning is enabled by default but can be disabled through the prune
option
when a cluster is defined:
new Cluster(this, "MyCluster", new ClusterProps {
Version = KubernetesVersion.V1_21,
Prune = false
});
Manifests Validation
The kubectl
CLI supports applying a manifest by skipping the validation.
This can be accomplished by setting the skipValidation
flag to true
in the KubernetesManifest
props.
Cluster cluster;
new KubernetesManifest(this, "HelloAppWithoutValidation", new KubernetesManifestProps {
Cluster = cluster,
Manifest = new [] { new Dictionary<string, object> { { "foo", "bar" } } },
SkipValidation = true
});
Helm Charts
The HelmChart
construct or cluster.addHelmChart
method can be used
to add Kubernetes resources to this cluster using Helm.
When using <code>cluster.addHelmChart</code>, the manifest construct is defined within the cluster's stack scope. If the manifest contains
attributes from a different stack which depend on the cluster stack, a circular dependency will be created and you will get a synth time error.
To avoid this, directly use <code>new HelmChart</code> to create the chart in the scope of the other stack.
The following example will install the NGINX Ingress Controller to your cluster using Helm.
Cluster cluster;
// option 1: use a construct
// option 1: use a construct
new HelmChart(this, "NginxIngress", new HelmChartProps {
Cluster = cluster,
Chart = "nginx-ingress",
Repository = "https://helm.nginx.com/stable",
Namespace = "kube-system"
});
// or, option2: use `addHelmChart`
cluster.AddHelmChart("NginxIngress", new HelmChartOptions {
Chart = "nginx-ingress",
Repository = "https://helm.nginx.com/stable",
Namespace = "kube-system"
});
Helm charts will be installed and updated using helm upgrade --install
, where a few parameters
are being passed down (such as repo
, values
, version
, namespace
, wait
, timeout
, etc).
This means that if the chart is added to CDK with the same release name, it will try to update
the chart in the cluster.
Additionally, the chartAsset
property can be an aws-s3-assets.Asset
. This allows the use of local, private helm charts.
using Amazon.CDK.AWS.S3.Assets;
Cluster cluster;
var chartAsset = new Asset(this, "ChartAsset", new AssetProps {
Path = "/path/to/asset"
});
cluster.AddHelmChart("test-chart", new HelmChartOptions {
ChartAsset = chartAsset
});
OCI Charts
OCI charts are also supported.
Also replace the ${VARS}
with appropriate values.
Cluster cluster;
// option 1: use a construct
// option 1: use a construct
new HelmChart(this, "MyOCIChart", new HelmChartProps {
Cluster = cluster,
Chart = "some-chart",
Repository = "oci://${ACCOUNT_ID}.dkr.ecr.${ACCOUNT_REGION}.amazonaws.com/${REPO_NAME}",
Namespace = "oci",
Version = "0.0.1"
});
Helm charts are implemented as CloudFormation resources in CDK.
This means that if the chart is deleted from your code (or the stack is
deleted), the next cdk deploy
will issue a helm uninstall
command and the
Helm chart will be deleted.
When there is no release
defined, a unique ID will be allocated for the release based
on the construct path.
By default, all Helm charts will be installed concurrently. In some cases, this
could cause race conditions where two Helm charts attempt to deploy the same
resource or if Helm charts depend on each other. You can use
chart.node.addDependency()
in order to declare a dependency order between
charts:
Cluster cluster;
var chart1 = cluster.AddHelmChart("MyChart", new HelmChartOptions {
Chart = "foo"
});
var chart2 = cluster.AddHelmChart("MyChart", new HelmChartOptions {
Chart = "bar"
});
chart2.Node.AddDependency(chart1);
CDK8s Charts
CDK8s is an open-source library that enables Kubernetes manifest authoring using familiar programming languages. It is founded on the same technologies as the AWS CDK, such as constructs
and jsii
.
To learn more about cdk8s, visit the <a href="https://cdk8s.io/docs/latest/getting-started/">Getting Started</a> tutorials.
The EKS module natively integrates with cdk8s and allows you to apply cdk8s charts on AWS EKS clusters via the cluster.addCdk8sChart
method.
In addition to cdk8s
, you can also use cdk8s+
, which provides higher level abstraction for the core kubernetes api objects.
You can think of it like the L2
constructs for Kubernetes. Any other cdk8s
based libraries are also supported, for example cdk8s-debore
.
To get started, add the following dependencies to your package.json
file:
"dependencies": {
"cdk8s": "^1.0.0",
"cdk8s-plus-21": "^1.0.0-beta.38",
"constructs": "^3.3.69"
}
Note that here we are using cdk8s-plus-21
as we are targeting Kubernetes version 1.21.0. If you operate a different kubernetes version, you should
use the corresponding cdk8s-plus-XX
library.
See Select the appropriate cdk8s+ library
for more details.
Similarly to how you would create a stack by extending @aws-cdk/core.Stack
, we recommend you create a chart of your own that extends cdk8s.Chart
,
and add your kubernetes resources to it. You can use aws-cdk
construct attributes and properties inside your cdk8s
construct freely.
In this example we create a chart that accepts an s3.Bucket
and passes its name to a kubernetes pod as an environment variable.
Notice that the chart must accept a constructs.Construct
type as its scope, not an @aws-cdk/core.Construct
as you would normally use.
For this reason, to avoid possible confusion, we will create the chart in a separate file:
+ my-chart.ts
using Amazon.CDK.AWS.S3;
using Constructs;
using Org.Cdk8s;
using Org.Cdk8s.Plus21;
class MyChartProps
{
public Bucket Bucket { get; set; }
}
class MyChart : Chart
{
public MyChart(Construct scope, string id, MyChartProps props) : base(scope, id)
{
new Pod(this, "Pod", new PodProps {
Containers = new [] {
new Container(new ContainerProps {
Image = "my-image",
EnvVariables = new Dictionary<string, EnvValue> {
{ "BUCKET_NAME", EnvValue.FromValue(props.Bucket.BucketName) }
}
}) }
});
}
}
Then, in your AWS CDK app:
Cluster cluster;
// some bucket..
var bucket = new Bucket(this, "Bucket");
// create a cdk8s chart and use `cdk8s.App` as the scope.
var myChart = new MyChart(new App(), "MyChart", new MyChartProps { Bucket = bucket });
// add the cdk8s chart to the cluster
cluster.AddCdk8sChart("my-chart", myChart);
Custom CDK8s Constructs
You can also compose a few stock cdk8s+
constructs into your own custom construct. However, since mixing scopes between aws-cdk
and cdk8s
is currently not supported, the Construct
class
you'll need to use is the one from the constructs
module, and not from @aws-cdk/core
like you normally would.
This is why we used new cdk8s.App()
as the scope of the chart above.
using Constructs;
using Org.Cdk8s;
using Org.Cdk8s.Plus21;
class LoadBalancedWebService
{
public int Port { get; set; }
public string Image { get; set; }
public int Replicas { get; set; }
}
var app = new App();
var chart = new Chart(app, "my-chart");
class LoadBalancedWebService : Construct
{
public LoadBalancedWebService(Construct scope, string id, LoadBalancedWebService props) : base(scope, id)
{
var deployment = new Deployment(chart, "Deployment", new DeploymentProps {
Replicas = props.Replicas,
Containers = new [] { new Container(new ContainerProps { Image = props.Image }) }
});
deployment.ExposeViaService(new ExposeDeploymentViaServiceOptions {
Port = props.Port,
ServiceType = ServiceType.LOAD_BALANCER
});
}
}
Manually importing k8s specs and CRD's
If you find yourself unable to use cdk8s+
, or just like to directly use the k8s
native objects or CRD's, you can do so by manually importing them using the cdk8s-cli
.
See Importing kubernetes objects for detailed instructions.
Patching Kubernetes Resources
The KubernetesPatch
construct can be used to update existing kubernetes
resources. The following example can be used to patch the hello-kubernetes
deployment from the example above with 5 replicas.
Cluster cluster;
new KubernetesPatch(this, "hello-kub-deployment-label", new KubernetesPatchProps {
Cluster = cluster,
ResourceName = "deployment/hello-kubernetes",
ApplyPatch = new Dictionary<string, object> { { "spec", new Dictionary<string, int> { { "replicas", 5 } } } },
RestorePatch = new Dictionary<string, object> { { "spec", new Dictionary<string, int> { { "replicas", 3 } } } }
});
Querying Kubernetes Resources
The KubernetesObjectValue
construct can be used to query for information about kubernetes objects,
and use that as part of your CDK application.
For example, you can fetch the address of a LoadBalancer
type service:
Cluster cluster;
// query the load balancer address
var myServiceAddress = new KubernetesObjectValue(this, "LoadBalancerAttribute", new KubernetesObjectValueProps {
Cluster = cluster,
ObjectType = "service",
ObjectName = "my-service",
JsonPath = ".status.loadBalancer.ingress[0].hostname"
});
// pass the address to a lambda function
var proxyFunction = new Function(this, "ProxyFunction", new FunctionProps {
Handler = "index.handler",
Code = Code.FromInline("my-code"),
Runtime = Runtime.NODEJS_14_X,
Environment = new Dictionary<string, string> {
{ "myServiceAddress", myServiceAddress.Value }
}
});
Specifically, since the above use-case is quite common, there is an easier way to access that information:
Cluster cluster;
var loadBalancerAddress = cluster.GetServiceLoadBalancerAddress("my-service");
Using existing clusters
The Amazon EKS library allows defining Kubernetes resources such as Kubernetes manifests and Helm charts on clusters that are not defined as part of your CDK app.
First, you'll need to "import" a cluster to your CDK app. To do that, use the
eks.Cluster.fromClusterAttributes()
static method:
var cluster = Cluster.FromClusterAttributes(this, "MyCluster", new ClusterAttributes {
ClusterName = "my-cluster-name",
KubectlRoleArn = "arn:aws:iam::1111111:role/iam-role-that-has-masters-access"
});
Then, you can use addManifest
or addHelmChart
to define resources inside
your Kubernetes cluster. For example:
Cluster cluster;
cluster.AddManifest("Test", new Dictionary<string, object> {
{ "apiVersion", "v1" },
{ "kind", "ConfigMap" },
{ "metadata", new Dictionary<string, string> {
{ "name", "myconfigmap" }
} },
{ "data", new Dictionary<string, string> {
{ "Key", "value" },
{ "Another", "123454" }
} }
});
At the minimum, when importing clusters for kubectl
management, you will need
to specify:
If the cluster is configured with private-only or private and restricted public Kubernetes endpoint access, you must also specify:
Logging
EKS supports cluster logging for 5 different types of events:
You can enable logging for each one separately using the clusterLogging
property. For example:
var cluster = new Cluster(this, "Cluster", new ClusterProps {
// ...
Version = KubernetesVersion.V1_21,
ClusterLogging = new [] { ClusterLoggingTypes.API, ClusterLoggingTypes.AUTHENTICATOR, ClusterLoggingTypes.SCHEDULER }
});
Known Issues and Limitations
Classes
AlbController | Construct for installing the AWS ALB Contoller on EKS clusters. |
AlbControllerOptions | Options for |
AlbControllerProps | Properties for |
AlbControllerVersion | Controller version. |
AlbScheme | ALB Scheme. |
AutoScalingGroupCapacityOptions | Options for adding worker nodes. |
AutoScalingGroupOptions | Options for adding an AutoScalingGroup as capacity. |
AwsAuth | Manages mapping between IAM users and roles to Kubernetes RBAC configuration. |
AwsAuthMapping | AwsAuth mapping. |
AwsAuthProps | Configuration props for the AwsAuth construct. |
BootstrapOptions | EKS node bootstrapping options. |
CapacityType | Capacity type of the managed node group. |
CfnAddon | A CloudFormation |
CfnAddonProps | Properties for defining a |
CfnCluster | A CloudFormation |
CfnCluster.ClusterLoggingProperty | The cluster control plane logging configuration for your cluster. |
CfnCluster.ControlPlanePlacementProperty | The placement configuration for all the control plane instances of your local Amazon EKS cluster on an AWS Outpost. |
CfnCluster.EncryptionConfigProperty | The encryption configuration for the cluster. |
CfnCluster.KubernetesNetworkConfigProperty | The Kubernetes network configuration for the cluster. |
CfnCluster.LoggingProperty | Enable or disable exporting the Kubernetes control plane logs for your cluster to CloudWatch Logs. |
CfnCluster.LoggingTypeConfigProperty | The enabled logging type. |
CfnCluster.OutpostConfigProperty | The configuration of your local Amazon EKS cluster on an AWS Outpost. |
CfnCluster.ProviderProperty | Identifies the AWS Key Management Service ( AWS KMS ) key used to encrypt the secrets. |
CfnCluster.ResourcesVpcConfigProperty | An object representing the VPC configuration to use for an Amazon EKS cluster. |
CfnClusterProps | Properties for defining a |
CfnFargateProfile | A CloudFormation |
CfnFargateProfile.LabelProperty | A key-value pair. |
CfnFargateProfile.SelectorProperty | An object representing an AWS Fargate profile selector. |
CfnFargateProfileProps | Properties for defining a |
CfnIdentityProviderConfig | A CloudFormation |
CfnIdentityProviderConfig.OidcIdentityProviderConfigProperty | An object representing the configuration for an OpenID Connect (OIDC) identity provider. |
CfnIdentityProviderConfig.RequiredClaimProperty | A key-value pair that describes a required claim in the identity token. |
CfnIdentityProviderConfigProps | Properties for defining a |
CfnNodegroup | A CloudFormation |
CfnNodegroup.LaunchTemplateSpecificationProperty | An object representing a node group launch template specification. |
CfnNodegroup.RemoteAccessProperty | An object representing the remote access configuration for the managed node group. |
CfnNodegroup.ScalingConfigProperty | An object representing the scaling configuration details for the Auto Scaling group that is associated with your node group. |
CfnNodegroup.TaintProperty | A property that allows a node to repel a set of pods. |
CfnNodegroup.UpdateConfigProperty | The update configuration for the node group. |
CfnNodegroupProps | Properties for defining a |
Cluster | A Cluster represents a managed Kubernetes Service (EKS). |
ClusterAttributes | Attributes for EKS clusters. |
ClusterLoggingTypes | EKS cluster logging types. |
ClusterOptions | Options for EKS clusters. |
ClusterProps | Common configuration props for EKS clusters. |
CommonClusterOptions | Options for configuring an EKS cluster. |
CoreDnsComputeType | The type of compute resources to use for CoreDNS. |
CpuArch | CPU architecture. |
DefaultCapacityType | The default capacity type for the cluster. |
EksOptimizedImage | Construct an Amazon Linux 2 image from the latest EKS Optimized AMI published in SSM. |
EksOptimizedImageProps | Properties for EksOptimizedImage. |
EndpointAccess | Endpoint access characteristics. |
FargateCluster | Defines an EKS cluster that runs entirely on AWS Fargate. |
FargateClusterProps | Configuration props for EKS Fargate. |
FargateProfile | Fargate profiles allows an administrator to declare which pods run on Fargate. |
FargateProfileOptions | Options for defining EKS Fargate Profiles. |
FargateProfileProps | Configuration props for EKS Fargate Profiles. |
HelmChart | Represents a helm chart within the Kubernetes system. |
HelmChartOptions | Helm Chart options. |
HelmChartProps | Helm Chart properties. |
IngressLoadBalancerAddressOptions | Options for fetching an IngressLoadBalancerAddress. |
KubectlProvider | Implementation of Kubectl Lambda. |
KubectlProviderAttributes | Kubectl Provider Attributes. |
KubectlProviderProps | Kubectl Provider Properties. |
KubernetesManifest | Represents a manifest within the Kubernetes system. |
KubernetesManifestOptions | Options for |
KubernetesManifestProps | Properties for KubernetesManifest. |
KubernetesObjectValue | Represents a value of a specific object deployed in the cluster. |
KubernetesObjectValueProps | Properties for KubernetesObjectValue. |
KubernetesPatch | A CloudFormation resource which applies/restores a JSON patch into a Kubernetes resource. |
KubernetesPatchProps | Properties for KubernetesPatch. |
KubernetesVersion | Kubernetes cluster version. |
LaunchTemplateSpec | Launch template property specification. |
MachineImageType | The machine image type. |
Nodegroup | The Nodegroup resource class. |
NodegroupAmiType | The AMI type for your node group. |
NodegroupOptions | The Nodegroup Options for addNodeGroup() method. |
NodegroupProps | NodeGroup properties interface. |
NodegroupRemoteAccess | The remote access (SSH) configuration to use with your node group. |
NodeType | Whether the worker nodes should support GPU or just standard instances. |
OpenIdConnectProvider | IAM OIDC identity providers are entities in IAM that describe an external identity provider (IdP) service that supports the OpenID Connect (OIDC) standard, such as Google or Salesforce. |
OpenIdConnectProviderProps | Initialization properties for |
PatchType | Values for |
Selector | Fargate profile selector. |
ServiceAccount | Service Account. |
ServiceAccountOptions | Options for |
ServiceAccountProps | Properties for defining service accounts. |
ServiceLoadBalancerAddressOptions | Options for fetching a ServiceLoadBalancerAddress. |
TaintEffect | Effect types of kubernetes node taint. |
TaintSpec | Taint interface. |
Interfaces
CfnCluster.IClusterLoggingProperty | The cluster control plane logging configuration for your cluster. |
CfnCluster.IControlPlanePlacementProperty | The placement configuration for all the control plane instances of your local Amazon EKS cluster on an AWS Outpost. |
CfnCluster.IEncryptionConfigProperty | The encryption configuration for the cluster. |
CfnCluster.IKubernetesNetworkConfigProperty | The Kubernetes network configuration for the cluster. |
CfnCluster.ILoggingProperty | Enable or disable exporting the Kubernetes control plane logs for your cluster to CloudWatch Logs. |
CfnCluster.ILoggingTypeConfigProperty | The enabled logging type. |
CfnCluster.IOutpostConfigProperty | The configuration of your local Amazon EKS cluster on an AWS Outpost. |
CfnCluster.IProviderProperty | Identifies the AWS Key Management Service ( AWS KMS ) key used to encrypt the secrets. |
CfnCluster.IResourcesVpcConfigProperty | An object representing the VPC configuration to use for an Amazon EKS cluster. |
CfnFargateProfile.ILabelProperty | A key-value pair. |
CfnFargateProfile.ISelectorProperty | An object representing an AWS Fargate profile selector. |
CfnIdentityProviderConfig.IOidcIdentityProviderConfigProperty | An object representing the configuration for an OpenID Connect (OIDC) identity provider. |
CfnIdentityProviderConfig.IRequiredClaimProperty | A key-value pair that describes a required claim in the identity token. |
CfnNodegroup.ILaunchTemplateSpecificationProperty | An object representing a node group launch template specification. |
CfnNodegroup.IRemoteAccessProperty | An object representing the remote access configuration for the managed node group. |
CfnNodegroup.IScalingConfigProperty | An object representing the scaling configuration details for the Auto Scaling group that is associated with your node group. |
CfnNodegroup.ITaintProperty | A property that allows a node to repel a set of pods. |
CfnNodegroup.IUpdateConfigProperty | The update configuration for the node group. |
IAlbControllerOptions | Options for |
IAlbControllerProps | Properties for |
IAutoScalingGroupCapacityOptions | Options for adding worker nodes. |
IAutoScalingGroupOptions | Options for adding an AutoScalingGroup as capacity. |
IAwsAuthMapping | AwsAuth mapping. |
IAwsAuthProps | Configuration props for the AwsAuth construct. |
IBootstrapOptions | EKS node bootstrapping options. |
ICfnAddonProps | Properties for defining a |
ICfnClusterProps | Properties for defining a |
ICfnFargateProfileProps | Properties for defining a |
ICfnIdentityProviderConfigProps | Properties for defining a |
ICfnNodegroupProps | Properties for defining a |
ICluster | An EKS cluster. |
IClusterAttributes | Attributes for EKS clusters. |
IClusterOptions | Options for EKS clusters. |
IClusterProps | Common configuration props for EKS clusters. |
ICommonClusterOptions | Options for configuring an EKS cluster. |
IEksOptimizedImageProps | Properties for EksOptimizedImage. |
IFargateClusterProps | Configuration props for EKS Fargate. |
IFargateProfileOptions | Options for defining EKS Fargate Profiles. |
IFargateProfileProps | Configuration props for EKS Fargate Profiles. |
IHelmChartOptions | Helm Chart options. |
IHelmChartProps | Helm Chart properties. |
IIngressLoadBalancerAddressOptions | Options for fetching an IngressLoadBalancerAddress. |
IKubectlProvider | Imported KubectlProvider that can be used in place of the default one created by CDK. |
IKubectlProviderAttributes | Kubectl Provider Attributes. |
IKubectlProviderProps | Kubectl Provider Properties. |
IKubernetesManifestOptions | Options for |
IKubernetesManifestProps | Properties for KubernetesManifest. |
IKubernetesObjectValueProps | Properties for KubernetesObjectValue. |
IKubernetesPatchProps | Properties for KubernetesPatch. |
ILaunchTemplateSpec | Launch template property specification. |
INodegroup | NodeGroup interface. |
INodegroupOptions | The Nodegroup Options for addNodeGroup() method. |
INodegroupProps | NodeGroup properties interface. |
INodegroupRemoteAccess | The remote access (SSH) configuration to use with your node group. |
IOpenIdConnectProviderProps | Initialization properties for |
ISelector | Fargate profile selector. |
IServiceAccountOptions | Options for |
IServiceAccountProps | Properties for defining service accounts. |
IServiceLoadBalancerAddressOptions | Options for fetching a ServiceLoadBalancerAddress. |
ITaintSpec | Taint interface. |