Skip to main content

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​

  1. Resources Module

    • Creates and manages EKS components, including:
      • EKS Cluster
      • Managed Node Groups
      • IAM Roles & Policies
      • VPC Networking Integration
      • CloudWatch Logging
  2. Data Module

    • Fetches information about existing EKS clusters.
    • Useful for referencing attributes like cluster ARN, endpoint, and certificate.
  3. 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

# 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"
}
}

Required​

NameDescriptionTypeExample
cluster_nameName of the EKS clusterstring"my-eks-cluster"
cluster_versionKubernetes version for the clusterstring"1.30"
subnet_idsList of subnet IDs for worker nodeslist["subnet-123456"]
vpc_idVPC ID where the cluster will be deployedstring"vpc-123456"

Optional​

NameDescriptionTypeDefault
enable_cluster_loggingEnable or disable cluster control plane loggingboolfalse
node_group_nameName of the managed node groupstring"default-ng"
node_instance_typesEC2 instance types for worker nodeslist["t3.medium"]
desired_sizeDesired number of worker nodesnumber2
min_sizeMinimum number of worker nodesnumber1
max_sizeMaximum number of worker nodesnumber3
tagsKey-value tags to apply to EKS resourcesmap{}