Amazon EKS Tutorial: Part 1

Jul 28, 2024

Amazon EKS Tutorial: Part 1 Notes

Introduction to Tutorial

  • Creating network components for Amazon EKS.
  • Using Terraform for infrastructure management.

Network Components Overview

  • VPC Creation: Required for setting up the network.
  • Subnets: 4 subnets (2 private, 2 public) across 2 availability zones (AZs).
    • Private Subnets: To deploy Kubernetes nodes.
    • Public Subnets: To provision load balancers.
  • Internet Gateway: Attached to VPC for internet access for the public subnets.
  • NAT Gateway: For translating private IP addresses to public ones.
  • Route Tables: Essential for directing traffic.

Detailed Steps

Infrastructure Planning

  1. Define Subnets:
    • 2 Public Subnets, 2 Private Subnets in 2 different AZs.
    • Must have multiple subnets in at least 2 AZs for EKS.

Creating Key Network Components

  • Internet Gateway: Supports public VM internet access.
  • NAT Gateway: Provides internet access for private subnets.
  • Route Tables:
    • Public Route Table: Default route to Internet Gateway.
    • Private Route Table: Default route to NAT Gateway.

Subnet Setup

  • Tagging Requirements:
    • Environment prefix and subnet types.
    • internal-elb for private load balancers.
    • EKS cluster name for shared or owned resources.

NAT Gateway Configuration

  • Place in a public subnet with a default route to the Internet Gateway.
  • Recommend using a static public IP for stability.

Final Steps

  • Create Private and Public Route Tables:
    • Associate the private route table with the private subnets.
    • Associate the public route table with the public subnets.
  • Initialize Terraform state: terraform init to download providers and set up state file.

Authentication Setup

  • AWS Profile and Access Keys:
    1. Use aws configure to set up credentials.
    2. Best practice: Use IAM roles with short-lived credentials instead of long-lived keys.

Terraform Application

  • Execute terraform apply to create VPC and subnets.
  • Expected duration: 2-3 minutes.

Console Review

  • After execution, check:
    • VPC: Named staging-main.
    • Subnets: Have the correct configurations (2 private, 2 public).
    • Route Tables: Correct default routes set.
    • Gateways: Review NAT and Internet Gateways.

Conclusion

  • This section provided an overview of creating a VPC for EKS using Terraform.
  • It's essential to understand each component's role in ensuring a functional Kubernetes environment.