hajowieland
terraform-k8s-the-real-hard-way-aws
HCL

Terraform code for "Kubernetes The (real) Hard Way (AWS)"

Last updated Aug 28, 2024
39
Stars
31
Forks
0
Issues
0
Stars/day
Attention Score
18
Language breakdown
HCL 92.3%
Shell 7.7%
Files click to expand
README

Terraform - Kubernetes The (real) Hard Way on AWS!

This little project creates the infrastructure in Terraform for my blog post Kubernetes The (real) Hard Way on AWS.

AWS CDK Python code available 🔗 HERE

You can practice creating a multi node K8s Cluster yourself for training purposes or CKA exam preparation.

Alt text

Requirements

  • aws-cli Profile
  • Existing AWS Route53 Public Hosted Zone

Features

Default values - you can adapt all of them to your needs

  • Terraform 0.12
  • 1x VPC, 3x Public Subnets, 3x Private Subnets, Route Tables, Routes
  • 3x Worker Nodes
  • 3x Master Nodes
  • 3x Etcd Nodes
  • 1x Bastion Host
  • Genertes AWS Key Pair for instances
  • Route53 Records for internal & external IPv4 addresses
  • 1x Public LoadBalancer for Master Nodes (external kubectl access)
  • 1x Private LoadBalancer for Master Nodes (fronting kube-apiservers)
  • 1x Public LoadBalancer for Bation Host (AutoScalingGroup)
  • Gets most recent Ubuntu AMI for all regions
  • Install awscli, cfssl, cfssl_json via UserData
  • Allows external access from workstation IPv4 address only

Inputs

| Name | Description | Type | Default | Required | |------|-------------|:----:|:-----:|:-----:| | availability\_zones | Number of different AZs to use | number | "3" | no | | aws\key\pair\_name | AWS Key Pair name to use for EC2 Instances (if already existent) | string | "null" | no | | aws\_profile | AWS cli profile (e.g. default) | string | "default" | no | | aws\_region | AWS region (e.g. us-east-1 => US North Virginia) | string | "us-east-1" | no | | aws\vpc\cidr | VPC CIDR block | string | "10.23.0.0/16" | no | | bastion\instance\type | EC2 instance type for Bastion Host | string | "t3a.small" | no | | bastion\max\size | Maximum number of EC2 instances for Bastion AutoScalingGroup | number | "1" | no | | bastion\min\size | Minimum number of EC2 instances for Bastion AutoScalingGroup | number | "1" | no | | bastion\_size | Desired number of EC2 instances for Bastion AutoScalingGroup | number | "1" | no | | etcd\instance\type | EC2 instance type for etcd instances | string | "t3a.small" | no | | etcd\max\size | Maximum number of EC2 instances for etcd AutoScalingGroup | number | "3" | no | | etcd\min\size | Minimum number of EC2 instances for etcd AutoScalingGroup | number | "3" | no | | etcd\_size | Desired number of EC2 instances for etcd AutoScalingGroup | number | "3" | no | | hosted\_zone | Route53 Hosted Zone for creating records (without . suffix, e.g. napo.io) | string | n/a | yes | | master\instance\type | EC2 instance type for K8s master instances | string | "t3a.small" | no | | master\max\size | Maximum number of EC2 instances for K8s Master AutoScalingGroup | number | "3" | no | | master\min\size | Minimum number of EC2 instances for K8s Master AutoScalingGroup | number | "3" | no | | master\_size | Desired number of EC2 instances for K8s Master AutoScalingGroup | number | "3" | no | | owner | Owner name used for tags | string | "napo.io" | no | | pod\cidr | The first two octets for the Pod network CIDR (used in Worker UserData to generate PODCIDR envvar) | string | "10.200" | no | | project | Project name used for tags | string | "k8s-the-right-hard-way-aws" | no | | ssh\public\key\path | SSH public key path (to create a new AWS Key Pair from existing local SSH public RSA key) | string | "~/.ssh/idrsa.pub" | no | | stage | Environment name (e.g. testing, dev, staging, prod) | string | "testing" | no | | worker\instance\type | EC2 instance type for K8s worker instances | string | "t3a.small" | no | | worker\max\size | Maximum number of EC2 instances for K8s Worker AutoScalingGroup | number | "3" | no | | worker\min\size | Minimum number of EC2 instances for K8s Worker AutoScalingGroup | number | "3" | no | | worker\_size | Desired number of EC2 instances for K8s Worker AutoScalingGroup | number | "3" | no |

Outputs

| Name | Description | |------|-------------| | route53\bastion\public\_fqdn | Route53 record for Bastion Host Load Balancer | | route53\master-public-lb\public\_fqdn | Route53 record for Master Public Load Balancer |

🔗 More in this category

© 2026 GitRepoTrend · hajowieland/terraform-k8s-the-real-hard-way-aws · Updated daily from GitHub