Amazon Elastic Kubernetes Service (EKS)
Overviewβ
The Amazon EKS Module provides a reusable and scalable way to provision and manage Amazon Elastic Kubernetes Service (EKS) clusters using Terraform.
It abstracts the complexity of configuring Kubernetes control planes and worker nodes, enabling developers to deploy containerized applications securely and reliably on AWS.
This module supports both resource creation and data sources for managing EKS clusters, node groups, and associated IAM roles.
Featuresβ
- π Reusable & Modular β Predefined structure for EKS clusters and node groups.
- βΈοΈ Managed Kubernetes β Run Kubernetes without needing to manage the control plane.
- π Secure by Default β Integrates with IAM for RBAC, and VPC for networking isolation.
- π Scalable β Add or remove managed node groups to handle workloads dynamically.
- π§βπ€βπ§ Team-Friendly β Supports multiple namespaces and fine-grained IAM roles.
- π Tagging & Logging β Apply tags to EKS resources and enable CloudWatch logging.
- π§© Extensible β Works seamlessly with other modules (VPC, IAM, Auto Scaling, etc.).
Core Conceptsβ
-
Resources Module
- Creates and manages EKS components, including:
- EKS Cluster
- Managed Node Groups
- IAM Roles & Policies
- VPC Networking Integration
- CloudWatch Logging
- Creates and manages EKS components, including:
-
Data Module
- Fetches information about existing EKS clusters.
- Useful for referencing attributes like cluster ARN, endpoint, and certificate.
-
Separation of Concerns
resources/handles EKS cluster creation and configuration.data/is focused on reading and referencing existing EKS resources.- This separation ensures clarity, reusability, and modular design.
Sample Usage
- Terraform
- Terragrunt
- Opentofu
# DEPLOY ANANTA CLOUD'S EKS MODULE
module "eks" {
source = "github.com/anantacloud/terraform-aws-kubernetes-module/modules/resources"
# ==========================
# REQUIRED VARIABLES
# ==========================
cluster_name = "my-eks-cluster"
cluster_version = "1.30"
subnet_ids = ["subnet-123456", "subnet-654321"]
vpc_id = "vpc-123456"
# ==========================
# OPTIONAL VARIABLES
# ==========================
enable_cluster_logging = true
node_group_name = "my-node-group"
node_instance_types = ["t3.medium"]
desired_size = 2
min_size = 1
max_size = 3
tags = {
Environment = "dev"
Project = "my-app"
}
}
# terragrunt.hcl
terraform {
source = "github.com/anantacloud/terraform-aws-kubernetes-module/modules/resources"
}
inputs = {
cluster_name = "my-eks-cluster"
cluster_version = "1.30"
subnet_ids = ["subnet-123456", "subnet-654321"]
vpc_id = "vpc-123456"
enable_cluster_logging = true
node_group_name = "my-node-group"
node_instance_types = ["t3.medium"]
desired_size = 2
min_size = 1
max_size = 3
tags = {
Environment = "dev"
Project = "my-app"
}
}
# Opentofu.hcl
terraform {
source = "github.com/anantacloud/terraform-aws-kubernetes-module/modules/resources"
}
inputs = {
cluster_name = "my-eks-cluster"
cluster_version = "1.30"
subnet_ids = ["subnet-123456", "subnet-654321"]
vpc_id = "vpc-123456"
enable_cluster_logging = true
node_group_name = "my-node-group"
node_instance_types = ["t3.medium"]
desired_size = 2
min_size = 1
max_size = 3
tags = {
Environment = "dev"
Project = "my-app"
}
}
- Inputs
- Outputs
Requiredβ
| Name | Description | Type | Example |
|---|---|---|---|
| cluster_name | Name of the EKS cluster | string | "my-eks-cluster" |
| cluster_version | Kubernetes version for the cluster | string | "1.30" |
| subnet_ids | List of subnet IDs for worker nodes | list | ["subnet-123456"] |
| vpc_id | VPC ID where the cluster will be deployed | string | "vpc-123456" |
Optionalβ
| Name | Description | Type | Default |
|---|---|---|---|
| enable_cluster_logging | Enable or disable cluster control plane logging | bool | false |
| node_group_name | Name of the managed node group | string | "default-ng" |
| node_instance_types | EC2 instance types for worker nodes | list | ["t3.medium"] |
| desired_size | Desired number of worker nodes | number | 2 |
| min_size | Minimum number of worker nodes | number | 1 |
| max_size | Maximum number of worker nodes | number | 3 |
| tags | Key-value tags to apply to EKS resources | map | {} |
| Name | Description |
|---|---|
| cluster_id | The ID of the EKS cluster |
| cluster_name | The name of the EKS cluster |
| cluster_arn | The ARN of the EKS cluster |
| cluster_endpoint | The endpoint of the Kubernetes API server |
| cluster_version | The Kubernetes version of the cluster |
| node_group_id | The ID of the EKS managed node group |
| node_group_name | The name of the EKS managed node group |