AWS Cloud Infrastructure Architecture
This document provides a comprehensive overview of the AWS infrastructure architecture for the HA RKE2 Kubernetes cluster.
┌──────────────────────────────────────────────────────────────────────────────┐
│ AWS CLOUD │
│ ┌────────────────────────────────────────────────────────────────────────┐ │
│ │ VPC (10.0.0.0/16) │ │
│ │ │ │
│ │ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │ │
│ │ │ Availability │ │ Availability │ │ Availability │ │ │
│ │ │ Zone A │ │ Zone B │ │ Zone C │ │ │
│ │ │ │ │ │ │ │ │ │
│ │ │ ┌─────────────┐ │ │ ┌─────────────┐ │ │ ┌─────────────┐ │ │ │
│ │ │ │Public Subnet│ │ │ │Public Subnet│ │ │ │Public Subnet│ │ │ │
│ │ │ │10.0.1.0/24 │ │ │ │10.0.2.0/24 │ │ │ │10.0.3.0/24 │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ ┌─────────┐ │ │ │ │ ┌─────────┐ │ │ │ │ ┌─────────┐ │ │ │ │
│ │ │ │ │ CP-1 │ │ │ │ │ │ CP-2 │ │ │ │ │ │ CP-3 │ │ │ │ │
│ │ │ │ │ (etcd) │ │ │ │ │ │ (etcd) │ │ │ │ │ │ (etcd) │ │ │ │ │
│ │ │ │ └─────────┘ │ │ │ │ └─────────┘ │ │ │ │ └─────────┘ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ ┌─────────┐ │ │ │ │ ┌─────────┐ │ │ │ │ ┌─────────┐ │ │ │ │
│ │ │ │ │Worker-1 │ │ │ │ │ │Worker-2 │ │ │ │ │ │Worker-3 │ │ │ │ │
│ │ │ │ │ (agent) │ │ │ │ │ │ (agent) │ │ │ │ │ │ (agent) │ │ │ │ │
│ │ │ │ └─────────┘ │ │ │ │ └─────────┘ │ │ │ │ └─────────┘ │ │ │ │
│ │ │ └─────────────┘ │ │ └─────────────┘ │ │ └─────────────┘ │ │ │
│ │ └─────────────────┘ └─────────────────┘ └─────────────────┘ │ │
│ │ │ │
│ │ ┌─────────────────────────┐ │ │
│ │ │ Network Load Balancer │ │ │
│ │ │ (Cross-Zone LB) │ │ │
│ │ │ Ports: 6443, 9345 │ │ │
│ │ └─────────────────────────┘ │ │
│ │ │ │
│ │ ┌─────────────────────────────────────────────────────────────┐ │ │
│ │ │ Internet Gateway │ │ │
│ │ └─────────────────────────────────────────────────────────────┘ │ │
│ └────────────────────────────────────────────────────────────────────────┘ │
└──────────────────────────────────────────────────────────────────────────────┘
│
│
┌────┴────┐
│INTERNET │
└─────────┘
┌───────────────────────────────────────────────────────────────────────────┐
│ VPC: 10.0.0.0/16 │
│ (65,536 IP addresses) │
│ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ Internet Gateway (IGW) │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ Public Route Table │ │
│ │ Destination: 0.0.0.0/0 → Target: IGW │ │
│ │ Destination: 10.0.0.0/16 → Target: local │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ ┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐ │
│ │ Public Subnet │ │ Public Subnet │ │ Public Subnet │ │
│ │ 10.0.1.0/24 │ │ 10.0.2.0/24 │ │ 10.0.3.0/24 │ │
│ │ (254 hosts) │ │ (254 hosts) │ │ (254 hosts) │ │
│ │ │ │ │ │ │ │
│ │ AZ: us-east-1a │ │ AZ: us-east-1b │ │ AZ: us-east-1c │ │
│ │ │ │ │ │ │ │
│ │ Auto-assign │ │ Auto-assign │ │ Auto-assign │ │
│ │ Public IP: Yes │ │ Public IP: Yes │ │ Public IP: Yes │ │
│ └──────────────────┘ └──────────────────┘ └──────────────────┘ │
│ │
│ Kubernetes Tags: │
│ - kubernetes.io/role/elb = "1" (ELB auto-discovery) │
│ - kubernetes.io/cluster/${cluster_name} = "shared" │
│ │
└───────────────────────────────────────────────────────────────────────────┘
Subnet
CIDR
Availability Zone
Purpose
Public-1
10.0.1.0/24
us-east-1a
Control Plane 1, Worker 1
Public-2
10.0.2.0/24
us-east-1b
Control Plane 2, Worker 2
Public-3
10.0.3.0/24
us-east-1c
Control Plane 3, Worker 3
┌──────────────────────────────────────────────────────────────────────────┐
│ CONTROL PLANE ARCHITECTURE │
├──────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │
│ │ Control Plane │ │ Control Plane │ │ Control Plane │ │
│ │ Node 1 │ │ Node 2 │ │ Node 3 │ │
│ │ │ │ │ │ │ │
│ │ ┌───────────┐ │ │ ┌───────────┐ │ │ ┌───────────┐ │ │
│ │ │ RKE2 │ │ │ │ RKE2 │ │ │ │ RKE2 │ │ │
│ │ │ Server │ │ │ │ Server │ │ │ │ Server │ │ │
│ │ └───────────┘ │ │ └───────────┘ │ │ └───────────┘ │ │
│ │ │ │ │ │ │ │
│ │ ┌───────────┐ │ │ ┌───────────┐ │ │ ┌───────────┐ │ │
│ │ │ etcd │◄─┼───┼─►│ etcd │◄─┼───┼─►│ etcd │ │ │
│ │ │ Member │ │ │ │ Member │ │ │ │ Member │ │ │
│ │ └───────────┘ │ │ └───────────┘ │ │ └───────────┘ │ │
│ │ │ │ │ │ │ │
│ │ Instance Type: │ │ Instance Type: │ │ Instance Type: │ │
│ │ t3.medium │ │ t3.medium │ │ t3.medium │ │
│ │ │ │ │ │ │ │
│ │ EBS: 50GB gp3 │ │ EBS: 50GB gp3 │ │ EBS: 50GB gp3 │ │
│ │ (Encrypted) │ │ (Encrypted) │ │ (Encrypted) │ │
│ │ │ │ │ │ │ │
│ │ OS: Ubuntu │ │ OS: Ubuntu │ │ OS: Ubuntu │ │
│ │ 22.04 LTS │ │ 22.04 LTS │ │ 22.04 LTS │ │
│ └─────────────────┘ └─────────────────┘ └─────────────────┘ │
│ │ │ │ │
│ AZ: 1a AZ: 1b AZ: 1c │
│ │
└──────────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────────────┐
│ WORKER NODE ARCHITECTURE │
├──────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │
│ │ Worker Node │ │ Worker Node │ │ Worker Node │ │
│ │ 1 │ │ 2 │ │ 3 │ │
│ │ │ │ │ │ │ │
│ │ ┌───────────┐ │ │ ┌───────────┐ │ │ ┌───────────┐ │ │
│ │ │ RKE2 │ │ │ │ RKE2 │ │ │ │ RKE2 │ │ │
│ │ │ Agent │ │ │ │ Agent │ │ │ │ Agent │ │ │
│ │ └───────────┘ │ │ └───────────┘ │ │ └───────────┘ │ │
│ │ │ │ │ │ │ │
│ │ ┌───────────┐ │ │ ┌───────────┐ │ │ ┌───────────┐ │ │
│ │ │ Kubelet │ │ │ │ Kubelet │ │ │ │ Kubelet │ │ │
│ │ └───────────┘ │ │ └───────────┘ │ │ └───────────┘ │ │
│ │ │ │ │ │ │ │
│ │ ┌───────────┐ │ │ ┌───────────┐ │ │ ┌───────────┐ │ │
│ │ │Containerd │ │ │ │Containerd │ │ │ │Containerd │ │ │
│ │ └───────────┘ │ │ └───────────┘ │ │ └───────────┘ │ │
│ │ │ │ │ │ │ │
│ │ ┌───────────┐ │ │ ┌───────────┐ │ │ ┌───────────┐ │ │
│ │ │ Cilium │ │ │ │ Cilium │ │ │ │ Cilium │ │ │
│ │ │ Agent │ │ │ │ Agent │ │ │ │ Agent │ │ │
│ │ └───────────┘ │ │ └───────────┘ │ │ └───────────┘ │ │
│ │ │ │ │ │ │ │
│ │ Instance Type: │ │ Instance Type: │ │ Instance Type: │ │
│ │ t3.medium │ │ t3.medium │ │ t3.medium │ │
│ │ │ │ │ │ │ │
│ │ Workload Pods │ │ Workload Pods │ │ Workload Pods │ │
│ │ NodePort Svc │ │ NodePort Svc │ │ NodePort Svc │ │
│ │ :30000-32767 │ │ :30000-32767 │ │ :30000-32767 │ │
│ └─────────────────┘ └─────────────────┘ └─────────────────┘ │
│ │ │ │ │
│ AZ: 1a AZ: 1b AZ: 1c │
│ │
└──────────────────────────────────────────────────────────────────────────┘
EC2 Instance Specifications
Component
Instance Type
vCPU
Memory
Storage
Count
Control Plane
t3.medium
2
4 GiB
50 GB gp3 (encrypted)
3
Worker Node
t3.medium
2
4 GiB
50 GB gp3 (encrypted)
3
Load Balancer Architecture
┌──────────────────────────────────────────────────────────────────────────┐
│ NETWORK LOAD BALANCER ARCHITECTURE │
├──────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────┐ │
│ │ INTERNET │ │
│ └──────────┬──────────┘ │
│ │ │
│ ▼ │
│ ┌───────────────────────────────┐ │
│ │ Network Load Balancer │ │
│ │ (External, Layer 4) │ │
│ │ │ │
│ │ Cross-Zone LB: Enabled │ │
│ │ Scheme: internet-facing │ │
│ └───────────────────────────────┘ │
│ │ │
│ ┌─────────────────────┴─────────────────────┐ │
│ │ │ │
│ ▼ ▼ │
│ ┌─────────────────────────┐ ┌─────────────────────────┐ │
│ │ Listener :6443 │ │ Listener :9345 │ │
│ │ (Kubernetes API) │ │ (RKE2 Supervisor) │ │
│ └───────────┬─────────────┘ └───────────┬─────────────┘ │
│ │ │ │
│ ▼ ▼ │
│ ┌─────────────────────────┐ ┌─────────────────────────┐ │
│ │ Target Group: k8s-api │ │ Target Group: rke2-sup │ │
│ │ Protocol: TCP │ │ Protocol: TCP │ │
│ │ Health: traffic-port │ │ Health: traffic-port │ │
│ └───────────┬─────────────┘ └───────────┬─────────────┘ │
│ │ │ │
│ └───────────────────┬───────────────────┘ │
│ │ │
│ ┌───────────────────────┼───────────────────────┐ │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ CP-1 │ │ CP-2 │ │ CP-3 │ │
│ │ :6443 │ │ :6443 │ │ :6443 │ │
│ │ :9345 │ │ :9345 │ │ :9345 │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
│ │
└──────────────────────────────────────────────────────────────────────────┘
Endpoints:
- Kubernetes API: https://<nlb-dns>:6443
- RKE2 Registration: https://<nlb-dns>:9345
Feature
Benefit
Layer 4 (TCP)
Low latency, preserves client IP
Cross-Zone LB
Even distribution across all AZs
Health Checks
Automatic removal of unhealthy targets
Static DNS
Consistent endpoint for kubeconfig
┌─────────────────────────────────────────────────────────────────────────┐
│ SECURITY GROUP ARCHITECTURE │
├─────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌────────────────────────────────────────────────────────────────────┐ │
│ │ Control Plane Security Group │ │
│ │ │ │
│ │ INBOUND RULES: │ │
│ │ ┌─────────────────────────────────────────────────────────────┐ │ │
│ │ │ Port │ Protocol │ Source │ Purpose │ │ │
│ │ │──────│──────────│───────────────│───────────────────────────│ │ │
│ │ │ 22 │ TCP │ Admin CIDRs │ SSH Access │ │ │
│ │ │ 6443 │ TCP │ 0.0.0.0/0 │ Kubernetes API │ │ │
│ │ │ 9345 │ TCP │ 0.0.0.0/0 │ RKE2 Supervisor │ │ │
│ │ │2379-81│ TCP │ Self (CP SG) │ etcd Peer Communication │ │ │
│ │ │10250 │ TCP │ VPC CIDR │ Kubelet API │ │ │
│ │ │ 4240 │ TCP │ VPC CIDR │ Cilium Health │ │ │
│ │ │ 8472 │ UDP │ VPC CIDR │ Cilium VXLAN │ │ │
│ │ │ ICMP │ All │ VPC CIDR │ Cilium Connectivity │ │ │
│ │ └─────────────────────────────────────────────────────────────┘ │ │
│ │ │ │
│ │ OUTBOUND RULES: Allow all (0.0.0.0/0) │ │
│ └────────────────────────────────────────────────────────────────────┘ │
│ │
│ ┌────────────────────────────────────────────────────────────────────┐ │
│ │ Worker Security Group │ │
│ │ │ │
│ │ INBOUND RULES: │ │
│ │ ┌─────────────────────────────────────────────────────────────┐ │ │
│ │ │ Port │ Protocol │ Source │ Purpose │ │ │
│ │ │───────│──────────│──────────────│───────────────────────────│ │ │
│ │ │ 22 │ TCP │ Admin CIDRs │ SSH Access │ │ │
│ │ │ 10250 │ TCP │ VPC CIDR │ Kubelet API │ │ │
│ │ │30000- │ TCP │ 0.0.0.0/0 │ NodePort Services │ │ │
│ │ │ 32767 │ │ │ │ │ │
│ │ │ 4240 │ TCP │ VPC CIDR │ Cilium Health │ │ │
│ │ │ 8472 │ UDP │ VPC CIDR │ Cilium VXLAN │ │ │
│ │ │ ICMP │ All │ VPC CIDR │ Cilium Connectivity │ │ │
│ │ └─────────────────────────────────────────────────────────────┘ │ │
│ │ │ │
│ │ OUTBOUND RULES: Allow all (0.0.0.0/0) │ │
│ └────────────────────────────────────────────────────────────────────┘ │
│ │
│ CROSS-SECURITY GROUP RULES: │
│ ┌────────────────────────────────────────────────────────────────────┐ │
│ │ Worker → Control Plane :6443 (Kubernetes API access) │ │
│ │ Worker → Control Plane :9345 (RKE2 supervisor access) │ │
│ │ Control Plane → Worker :10250 (Kubelet API access) │ │
│ └────────────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────┘
Feature
Implementation
Encryption at Rest
EBS volumes encrypted
Network Isolation
VPC with security groups
Cluster Token
Auto-generated 64-char token
Control Plane Protection
Node taint prevents workload scheduling
Sensitive Data
Terraform sensitive outputs
┌───────────────────────────────────────────────────────────────────────┐
│ KUBECTL REQUEST FLOW │
├───────────────────────────────────────────────────────────────────────┤
│ │
│ Developer │
│ │ │
│ │ kubectl get pods │
│ ▼ │
│ ┌──────────────┐ │
│ │ kubeconfig │ server: https://<nlb-dns>:6443 │
│ └──────┬───────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────┐ │
│ │ Network Load │ Port 6443 │
│ │ Balancer │ │
│ └──────────┬──────────┘ │
│ │ │
│ │ Health Check: Selects healthy CP node │
│ │ │
│ ├─────────────────┬─────────────────┐ │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ ┌───────────┐ ┌───────────┐ ┌───────────┐ │
│ │ CP-1 │ │ CP-2 │ │ CP-3 │ │
│ │ kube-api │ │ kube-api │ │ kube-api │ │
│ └─────┬─────┘ └───────────┘ └───────────┘ │
│ │ │
│ │ Request routed to one CP (e.g., CP-1) │
│ ▼ │
│ ┌───────────┐ │
│ │ etcd │ Read from local or leader │
│ │ cluster │ │
│ └─────┬─────┘ │
│ │ │
│ ▼ │
│ ┌───────────┐ │
│ │ Response │ │
│ │ to User │ │
│ └───────────┘ │
│ │
└───────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────┐
│ POD SCHEDULING FLOW │
├─────────────────────────────────────────────────────────────────────────┤
│ │
│ kubectl apply -f deployment.yaml │
│ │ │
│ ▼ │
│ ┌─────────────────────┐ ┌─────────────────────┐ │
│ │ kube-apiserver │───────►│ etcd cluster │ │
│ │ (via NLB) │ │ (store desired │ │
│ └──────────┬──────────┘ │ state) │ │
│ │ └─────────────────────┘ │
│ │ Watch event │
│ ▼ │
│ ┌─────────────────────┐ │
│ │ kube-scheduler │ Finds best node based on: │
│ │ (on CP nodes) │ - Resource availability │
│ └──────────┬──────────┘ - Node affinity │
│ │ - Taints/tolerations │
│ │ Bind pod to node │
│ ▼ │
│ ┌─────────────────────┐ │
│ │ kubelet │ On selected worker node │
│ │ (worker node) │ │
│ └──────────┬──────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────┐ ┌─────────────────────┐ │
│ │ containerd │───────►│ Pull image │ │
│ │ (runtime) │ │ Start container │ │
│ └──────────┬──────────┘ └─────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────┐ │
│ │ Cilium CNI │ Assign Pod IP from 10.42.0.0/16 │
│ │ (networking) │ Configure network policies │
│ └─────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────┐
│ CIDR ALLOCATION MAP │
├─────────────────────────────────────────────────────────────────────────┤
│ │
│ AWS VPC Network │
│ ┌───────────────────────────────────────────────────────────────────┐ │
│ │ 10.0.0.0/16 (65,536 IPs) │ │
│ │ │ │
│ │ ├─ 10.0.1.0/24 → Public Subnet AZ-a (254 hosts) │ │
│ │ ├─ 10.0.2.0/24 → Public Subnet AZ-b (254 hosts) │ │
│ │ ├─ 10.0.3.0/24 → Public Subnet AZ-c (254 hosts) │ │
│ │ └─ 10.0.4.0/22 → Reserved for future expansion │ │
│ │ │ │
│ └───────────────────────────────────────────────────────────────────┘ │
│ │
│ Kubernetes Overlay Networks │
│ ┌───────────────────────────────────────────────────────────────────┐ │
│ │ 10.42.0.0/16 (65,534 IPs) - Pod Network (Cilium) │ │
│ │ │ │
│ │ Each node gets a /24 subnet for pods: │ │
│ │ ├─ 10.42.0.0/24 → CP-1 pods │ │
│ │ ├─ 10.42.1.0/24 → CP-2 pods │ │
│ │ ├─ 10.42.2.0/24 → CP-3 pods │ │
│ │ ├─ 10.42.3.0/24 → Worker-1 pods │ │
│ │ ├─ 10.42.4.0/24 → Worker-2 pods │ │
│ │ └─ 10.42.5.0/24 → Worker-3 pods │ │
│ │ │ │
│ └───────────────────────────────────────────────────────────────────┘ │
│ │
│ ┌───────────────────────────────────────────────────────────────────┐ │
│ │ 10.43.0.0/16 (65,534 IPs) - Service Network │ │
│ │ │ │
│ │ ├─ 10.43.0.1 → kubernetes.default (API server) │ │
│ │ ├─ 10.43.0.10 → kube-dns (CoreDNS) │ │
│ │ └─ 10.43.x.x → ClusterIP services │ │
│ │ │ │
│ └───────────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────┘
Resource Type
Count
Details
VPC
1
10.0.0.0/16, DNS enabled
Internet Gateway
1
Attached to VPC
Public Subnets
3
One per AZ
Route Tables
1
Public routes via IGW
Security Groups
2
Control Plane + Worker
Network Load Balancer
1
Cross-zone enabled
NLB Target Groups
2
API (6443) + Supervisor (9345)
NLB Listeners
2
TCP passthrough
EC2 Instances (CP)
3
t3.medium, Ubuntu 22.04
EC2 Instances (Worker)
3
t3.medium, Ubuntu 22.04
EBS Volumes
6
50GB gp3 encrypted each
Key Pair
1
SSH access
Estimated Monthly Cost (us-east-1)
Resource
Specification
Monthly Cost (approx.)
EC2 (6x t3.medium)
On-demand
~$180
EBS (6x 50GB gp3)
-
~$24
NLB
-
~$18
Data Transfer
100GB
~$9
Total
-
~$231/month
Note: Costs vary by region and usage patterns. Consider Reserved Instances or Savings Plans for production.
Mermaid Architecture Diagram
For GitHub rendering, you can also use this Mermaid diagram:
graph TB
subgraph Internet
USER[User/kubectl]
end
subgraph AWS["AWS Cloud"]
subgraph VPC["VPC 10.0.0.0/16"]
IGW[Internet Gateway]
subgraph NLB["Network Load Balancer"]
L6443[":6443 Listener"]
L9345[":9345 Listener"]
end
subgraph AZa["Availability Zone A"]
SUB1["Subnet 10.0.1.0/24"]
CP1["Control Plane 1<br/>etcd member"]
W1["Worker 1"]
end
subgraph AZb["Availability Zone B"]
SUB2["Subnet 10.0.2.0/24"]
CP2["Control Plane 2<br/>etcd member"]
W2["Worker 2"]
end
subgraph AZc["Availability Zone C"]
SUB3["Subnet 10.0.3.0/24"]
CP3["Control Plane 3<br/>etcd member"]
W3["Worker 3"]
end
end
end
USER --> IGW
IGW --> L6443
IGW --> L9345
L6443 --> CP1 & CP2 & CP3
L9345 --> CP1 & CP2 & CP3
CP1 <--> CP2 <--> CP3
CP1 --> W1 & W2 & W3
CP2 --> W1 & W2 & W3
CP3 --> W1 & W2 & W3
Loading
Back to Main README | Next: HA RKE2 Guide