Creating a simple and fast EKS Cluster

Rodrigo Fernandes - Nov 3 - - Dev Community

As a DevOps engineer, having the ability to quickly create and manage Kubernetes clusters is essential. In this article, I'll show you three different ways to create an EKS cluster on AWS, from the simplest to the most complete, helping you be more efficient in your daily tasks.

How This Will Help DevOps Engineers

  • Quick Environment Setup: Create dev/test environments in minutes
  • Infrastructure as Code: Maintain cluster configurations in version control
  • Automation Ready: Easy to integrate with CI/CD pipelines
  • Scalable Approach: Start simple and evolve as needed

Choose the one that best suits your needs!

Option 1: EKS Cluster in One Command

For those who want to start quickly, there's a super simple way:

eksctl create cluster --name simple-cluster
Enter fullscreen mode Exit fullscreen mode

Done! With this single command you already have:

  • 2 t2.micro nodes
  • New VPC
  • Public subnets
  • Basic security groups

Option 2: Cluster with Custom Settings

If you need more control, you can use this command with parameters:

eksctl create cluster \
    --name middle-cluster \
    --region us-east-1 \
    --version 1.28 \
    --nodegroup-name workers \
    --node-type t3.medium \
    --nodes 2 \
    --nodes-min 2 \
    --nodes-max 4 \
    --managed \
    --asg-access \
    --external-dns-access \
    --full-ecr-access \
    --tags "Environment=development" \
    --zones us-east-1a,us-east-1b
Enter fullscreen mode Exit fullscreen mode

Done! This command gives you:

  • t3.medium nodes with auto-scaling
  • ECR and external DNS access
  • Organization tags
  • Specific availability zones

Option 3: Cluster via Configuration File

For more robust environments, use a cluster.yaml file:

apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig

metadata:
  name: hard-cluster
  region: us-east-1
  version: "1.28"
  tags:
    karpenter.sh/discovery: cluster-with-karpenter

availabilityZones: ["us-east-1a", "us-east-1b", "us-east-1c"]  

vpc:
  cidr: "10.0.0.0/16"
  nat:
    gateway: Single

iam:
  withOIDC: true

karpenter:
  version: 'v0.20.0'
  createServiceAccount: true
  withSpotInterruptionQueue: true

nodeGroups:
  - name: apps
    availabilityZones: ["us-east-1a", "us-east-1b", "us-east-1c"]
    instanceType: t3.medium
    desiredCapacity: 2
    minSize: 2
    maxSize: 4
   labels:
      role: apps
    tags:
      Environment: production
    iam:
      withAddonPolicies:
        autoScaler: true
        albIngress: true

- name: system
    instanceType: t3.small
    availabilityZones: ["us-east-1a", "us-east-1b", "us-east-1c"]
    desiredCapacity: 2
    minSize: 2
    maxSize: 3
    labels:
      role: system

cloudWatch:
    clusterLogging:
        enableTypes: ["api", "audit", "authenticator", "controllerManager", "scheduler"]
        logRetentionInDays: 1 

addons:
  - name: vpc-cni
    version: latest
  - name: coredns
    version: latest

Enter fullscreen mode Exit fullscreen mode

Execute with:

eksctl create cluster -f cluster.yaml
Enter fullscreen mode Exit fullscreen mode

Done! This configuration gives you:

  • Custom VPC with specific CIDR
  • Two node groups with different purposes:
  • Apps group: t3.medium nodes with auto-scaling
  • System group: t3.small nodes for system components
  • Auto Scaler and ALB Ingress enabled
  • Latest versions of core addons
  • Production-ready setup with proper labeling

Which Option to Choose?
Option 1 (Simple Command)

  • Quick tests
  • POCs
  • Learning

Option 2 (Command with parameters)

  • Development environment
  • Specific configurations
  • Script automation

Option 3 (Configuration file)

  • Production environment
  • Version-controlled configuration
  • Multiple node groups

Cleaning Up Resources
Don't forget to delete the cluster when you no longer need it:

# For any of the options
eksctl delete cluster --name CLUSTER_NAME
Enter fullscreen mode Exit fullscreen mode
# For cluster created with file
eksctl delete cluster -f cluster.yaml
Enter fullscreen mode Exit fullscreen mode

Conclusion

Creating EKS clusters quickly and efficiently brings several key benefits for DevOps professionals:

Time and Productivity Benefits
Rapid Development Cycles: Create new environments in minutes instead of hours
Quick Testing: Validate changes and configurations without long setup times
Fast Disaster Recovery: Quickly spin up new clusters if needed
Efficient Experimentation: Test new configurations and settings without lengthy processes

Cost Benefits
Pay Only What You Need: Create clusters only when needed
Environment Control: Easily spin up and tear down environments
Resource Optimization: Scale environments based on actual needs
Development Cost Reduction: Use temporary clusters for testing instead of maintaining permanent ones

Technical Benefits
Infrastructure as Code: Maintain consistent environments across teams
Version Control: Track all cluster configurations in Git
Automation Ready: Easily integrate with CI/CD pipelines
Environment Parity: Ensure development matches production

Team Benefits
Self-Service Infrastructure: Teams can create their own environments
Reduced Dependencies: Less reliance on infrastructure teams
Better Learning: Quick feedback loop for learning Kubernetes
Increased Confidence: More testing and validation opportunities

Business Benefits
Faster Time to Market: Reduce environment setup time
Improved Quality: More thorough testing in production-like environments
Risk Reduction: Test changes in isolated environments
Better Resource Utilization: Create and destroy environments as needed

By mastering these cluster creation methods, you'll be able to:
Support development teams more effectively
Respond to incidents faster
Manage resources more efficiently
Implement better testing practices
Improve your infrastructure automation

Remember: The ability to quickly create and manage EKS clusters isn't just about technical capability - it's about enabling your organization to move faster, work more efficiently, and deliver better results.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .