Skip to content

EKS Cluster Provisioning

Quickly spin up and tear down EKS clusters for development and testing using the k8s-automation repository.

Prerequisites

  • AWS CLI configured with valid credentials (see AWS SSO Setup)
  • eksctl installed (installation guide)
  • Sufficient AWS permissions (engineer or admin access)

Create a Cluster

  1. Clone the repository:

    git clone https://github.com/recro/k8s-automation.git
    cd k8s-automation
    

  2. Run the provisioning script:

    ./new_cluster.sh
    

  3. Enter a name when prompted:

    Enter a name for the cluster: my-dev-cluster
    

The script will: - Verify the cluster name doesn't already exist - Create an EKS cluster in us-east-1 using eksctl - Generate a cleanup script: remove_my-dev-cluster.sh

Note: Cluster creation takes approximately 15-20 minutes.

Delete a Cluster

Run the generated removal script:

./remove_my-dev-cluster.sh

The script will: - Delete the EKS cluster and all associated resources - Self-delete after successful completion

Important: Always delete your cluster before end of business to avoid unnecessary costs.

List Active Clusters

Check what clusters currently exist:

eksctl get clusters --region us-east-1

List Removal Scripts

See available cleanup scripts:

ls -1 remove_*.sh

What Gets Created

The eksctl create cluster command provisions:

  • EKS control plane
  • Managed node group (default configuration)
  • VPC with public/private subnets
  • IAM roles for cluster and nodes
  • Security groups

Cost Considerations

EKS clusters incur costs for: - Control plane ($0.10/hour) - EC2 instances (node group) - NAT gateways - Load balancers (if created)

Always clean up clusters when not in use.

Troubleshooting

Cluster already exists

Error: Cluster with name 'my-cluster' already exists.

Choose a different name or delete the existing cluster first.

eksctl not found

Install eksctl:

# macOS
brew install eksctl

# Linux
curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp
sudo mv /tmp/eksctl /usr/local/bin

AWS credentials expired

Re-authenticate:

aws sso login --profile recro-engineer

See Also