AWS EKS (AWS Managed Kubernetes) cluster bootstrap with EKS Blueprints
Admin
10/8/20241 min read
EKS Blueprints makes easier and faster for you to adopt Amazon Elastic Kubernetes Service (Amazon EKS). EKS Blueprints is a collection of Infrastructure as code modules which helps you deploy & configure the cluster. EKS Blueprints can be used to configure the Amazon EKS add-ons as well as popular open-source add-ons such as Prometheus, Karpenter, Argo CD and many more.
EKS Blueprints is implemented in two popular IaC frameworks, HashiCorp Terraform and AWS Cloud Development Kit (AWS CDK), which help you automate infrastructure deployments.
You can describe the configuration for the desired state of your EKS cluster, such as the control plane, worker nodes, and Kubernetes add-ons, as an IaC blueprint. Once a blueprint is configured, you can use it to deploy consistent environments across multiple AWS accounts and regions using continuous deployment automation. EKS Blueprints builds on existing work from the EKS open-source community, including using the terraform-aws-eks module for cluster provisioning.
Following Terraform example represents a simple blueprint that will deploy a new EKS cluster with a managed node group ->
module “eks_blueprints” {
source = “github.com/aws-ia/terraform-aws-eks-blueprints?ref=v4.0.2”
# EKS Cluster VPC and Subnet mandatory config
vpc_id = <vpc_id>
private_subnet_ids = <private_subnet_ids>
# EKS CLUSTER VERSION
cluster_version = “1.21”
# EKS MANAGED NODE GROUPS
managed_node_groups = {
mg_5 = {
node_group_name = “managed-ondemand”
instance_types = [“m5.large”]
min_size = “2”
}
}
}
#Add-ons
module “kubernetes_addons” {
source = “github.com/aws-ia/terraform-aws-eks-blueprints//modules/kubernetes-addons?ref=v4.0.2”
eks_cluster_id = module.eks_blueprints.eks_cluster_id
# EKS Add-ons
enable_amazon_eks_vpc_cni = true
enable_amazon_eks_coredns = true
enable_amazon_eks_kube_proxy = true
enable_amazon_eks_aws_ebs_csi_driver = true
# Self-managed Add-ons
enable_aws_for_fluentbit = true
enable_aws_load_balancer_controller = true
enable_aws_efs_csi_driver = true
enable_cluster_autoscaler = true
enable_metrics_server = true
}
With CDK
const app = new cdk.App();
const stackId = “<stack_id>”;
// By default will provision in a new VPC
blueprints.EksBlueprint.builder()
.region(‘us-west-2’)
.version(eks.KubernetesVersion.V1_21)
.addOns(
new blueprints.addons.VpcCniAddOn(),
new blueprints.addons.CoreDnsAddOn(),
new blueprints.addons.KubeProxyAddOn(),
// Self-managed Add-ons new blueprints.addons.AwsForFluentBitAddOn(), new blueprints.addons.AwsLoadBalancerControllerAddOn(), new blueprints.addons.ClusterAutoScalerAddOn(), new blueprints.addons.EfsCsiDriverAddOn(), new blueprints.addons.MetricsServerAddOn() ) .build(app, stackId);