C3 - Testing

7 minute read

How metarex can build an API to cost your running cloud

| C3 | testing |

The development testbed will consist of 2 different high availability Kubernetes cluster types, each running the same kubernetes pods on different node types. Identical infrastructure (otel, metarex, prometheus, grafana) will be used to extract, store and present the results.

  • Groups A cluster - Amazon EKS
    Using the native Amazon Kubernetes infrastructure to host the test environment - in theory, this should be the most controllable running on AWS
  • Group R cluster - Rancher K3s
    Designed to run with the same definitions as Group A - in theory this should be portable across platfrom so that we can measure a baseline infrastructure cost and isolate the executable code costs more accurately.
  • TBD - GKE - Google’s Kubernetes Engine for native costs
  • TBD - AKS - Microsoft Azure Kubernetes Service for native costs
  • TBD - ACK - Alibaba Cloud for Kubernetes native costs

I asked Claude (Anthropic Sonnet 4.0) to estimate the costs of the proposed comparison architecture

Quick Comparison Table

FeatureGroup A (EKS)Group R (k3s)
ManagementFully managed control planeSelf-managed
Monthly Cost~$248~$195
Setup Time~15 minutes~20 minutes
Control Plane HAAWS managed (3 AZs)Self-managed etcd cluster
Node ManagementManaged node groupsManual EC2 instances
NetworkingVPC CNIFlannel CNI
Load BalancingAWS LoadBalancer ServiceCaddy NodePort + NLB
StorageEBS CSI DriverLocal-path provisioner
MonitoringCloudWatch integrationPrometheus/Grafana
UpgradesManagedManual
ScalabilityAuto-scaling groupsManual scaling
ComplexityMediumLow

Architecture Comparison

Group A (EKS) Architecture

Internet β†’ AWS ALB β†’ EKS Managed Nodes β†’ Pods
            ↓
        VPC CNI β†’ ENI per Pod
            ↓
        EBS CSI β†’ Persistent Volumes
            ↓
        CloudWatch β†’ Monitoring

Group R (k3s) Architecture

Internet β†’ NLB β†’ NodePort (30080) β†’ Caddy Pods β†’ Apps
           ↓
       Flannel β†’ VXLAN Overlay
           ↓
       Local Storage β†’ Persistent Volumes
           ↓
       Prometheus β†’ Monitoring

Detailed Feature Comparison

1. Control Plane Management

Group A (EKS):

  • AWS manages etcd, API server, scheduler, controller manager
  • Automatic backups and disaster recovery
  • Multi-AZ deployment by default
  • Managed security patches and updates
  • 99.95% SLA

Group R (k3s):

  • Self-managed embedded etcd cluster
  • Manual backup strategy required
  • HA through multiple controller nodes
  • Manual security updates needed
  • Depends on EC2 SLA (99.99%)

2. Networking

Group A (EKS):

1
2
3
4
5
6
# VPC CNI provides:
- Native AWS networking
- Pod-to-pod communication via VPC
- Security groups per pod
- Multiple ENIs per node
- Direct integration with AWS services

Group R (k3s):

1
2
3
4
5
6
# Flannel provides:
- VXLAN overlay network
- Simpler networking model
- Less AWS integration
- Lower resource overhead
- Standard Kubernetes networking

3. Storage Options

Group A (EKS):

  • EBS CSI driver for persistent volumes
  • EFS CSI driver for shared storage
  • FSx integration available
  • Automatic volume provisioning
  • Cross-AZ volume attachment

Group R (k3s):

  • Local-path provisioner (default)
  • Manual EBS integration possible
  • Simpler storage model
  • Node-local storage binding
  • Manual backup strategies

4. Load Balancing

Group A (EKS):

1
2
3
4
5
6
7
8
# AWS Load Balancer Controller
apiVersion: v1
kind: Service
metadata:
  annotations:
    service.beta.kubernetes.io/aws-load-balancer-type: nlb
spec:
  type: LoadBalancer  # Creates AWS NLB automatically

Group R (k3s):

1
2
3
4
5
6
7
# Manual NLB + NodePort
apiVersion: v1
kind: Service
spec:
  type: NodePort
  ports:
  - nodePort: 30080  # Fixed port on all nodes
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
c3/
β”œβ”€β”€ πŸ“ group-a-eks/                     # EKS cluster deployment
β”‚   β”œβ”€β”€ πŸ“ terraform/                   # Infrastructure as code
β”‚   β”‚   β”œβ”€β”€ main.tf                     # Main Terraform configuration
β”‚   β”‚   β”œβ”€β”€ variables.tf                # Input variables
β”‚   β”‚   β”œβ”€β”€ outputs.tf                  # Output values
β”‚   β”‚   β”œβ”€β”€ vpc.tf                      # VPC configuration
β”‚   β”‚   β”œβ”€β”€ eks.tf                      # EKS cluster configuration
β”‚   β”‚   └── terraform.tfvars.example    # Example variables
β”‚   β”œβ”€β”€ πŸ“ k8s-manifests/              # Kubernetes manifests
β”‚   β”‚   β”œβ”€β”€ πŸ“ caddy/                  # Reverse proxy
β”‚   β”‚   β”œβ”€β”€ πŸ“ khello/                 # Hello application
β”‚   β”‚   β”œβ”€β”€ πŸ“ mariadb/                # Database
β”‚   β”‚   β”œβ”€β”€ πŸ“ pocketbase/             # Authentication service
β”‚   β”‚   β”œβ”€β”€ πŸ“ prometheus/             # Monitoring
β”‚   β”‚   └── πŸ“ grafana/                # Dashboards
β”‚   β”œβ”€β”€ πŸ“ scripts/                    # Management scripts
β”‚   β”‚   β”œβ”€β”€ setup-eks.sh               # Cluster setup
β”‚   β”‚   β”œβ”€β”€ deploy-apps.sh             # Application deployment
β”‚   β”‚   β”œβ”€β”€ test-deployment.sh         # Testing
β”‚   β”‚   β”œβ”€β”€ install-pod.sh             # Pod installation
β”‚   β”‚   β”œβ”€β”€ backup-cluster.sh          # Backup operations
β”‚   β”‚   β”œβ”€β”€ performance-tuning.sh      # Optimization
β”‚   β”‚   └── troubleshoot-cluster.sh    # Diagnostics
β”‚   β”œβ”€β”€ configure-environment.sh       # Environment configuration
β”‚   └── README.md                      # EKS documentation
β”‚
β”œβ”€β”€ πŸ“ group-r-k3s/                     # k3s cluster deployment
β”‚   β”œβ”€β”€ πŸ“ terraform/                   # Infrastructure as code
β”‚   β”‚   β”œβ”€β”€ main.tf                     # Main Terraform configuration
β”‚   β”‚   β”œβ”€β”€ variables.tf                # Input variables
β”‚   β”‚   β”œβ”€β”€ outputs.tf                  # Output values
β”‚   β”‚   β”œβ”€β”€ vpc.tf                      # VPC configuration
β”‚   β”‚   β”œβ”€β”€ instances.tf                # EC2 instances
β”‚   β”‚   β”œβ”€β”€ security-groups.tf          # Security groups
β”‚   β”‚   β”œβ”€β”€ πŸ“ user-data/              # Instance initialization
β”‚   β”‚   └── terraform.tfvars.example    # Example variables
β”‚   β”œβ”€β”€ πŸ“ k8s-manifests/              # Kubernetes manifests
β”‚   β”‚   └── [same structure as EKS]     # Adapted for k3s
β”‚   β”œβ”€β”€ πŸ“ scripts/                    # Management scripts
β”‚   β”‚   β”œβ”€β”€ setup-k3s.sh               # Cluster setup
β”‚   β”‚   β”œβ”€β”€ ssh-to-node.sh             # Node access
β”‚   β”‚   └── [same as EKS where applicable]
β”‚   β”œβ”€β”€ configure-environment.sh       # Environment configuration
β”‚   └── README.md                      # k3s documentation
β”‚
β”œβ”€β”€ πŸ“ gitops/                          # GitOps configuration
β”‚   β”œβ”€β”€ argocd-install.sh              # ArgoCD installation
β”‚   β”œβ”€β”€ app-of-apps.yaml               # Application management
β”‚   └── πŸ“ applications/               # ArgoCD applications
β”‚       β”œβ”€β”€ khello-app.yaml
β”‚       β”œβ”€β”€ pocketbase.yaml
β”‚       └── monitoring-stack.yaml
β”‚
β”œβ”€β”€ πŸ“ environments/                    # Multi-environment configs
β”‚   β”œβ”€β”€ πŸ“ base/                       # Base configurations
β”‚   β”‚   └── kustomization.yaml
β”‚   β”œβ”€β”€ πŸ“ development/                # Development environment
β”‚   β”‚   β”œβ”€β”€ kustomization.yaml
β”‚   β”‚   └── khello-dev.yaml
β”‚   β”œβ”€β”€ πŸ“ staging/                    # Staging environment
β”‚   β”‚   β”œβ”€β”€ kustomization.yaml
β”‚   β”‚   └── khello-staging.yaml
β”‚   └── πŸ“ production/                 # Production environment
β”‚       β”œβ”€β”€ kustomization.yaml
β”‚       β”œβ”€β”€ khello-production.yaml
β”‚       └── monitoring-production.yaml
β”‚
β”œβ”€β”€ πŸ“ monitoring/                      # Advanced monitoring
β”‚   β”œβ”€β”€ alertmanager-config.yaml       # Alert management
β”‚   β”œβ”€β”€ prometheus-rules-advanced.yaml # Monitoring rules
β”‚   └── grafana-dashboard-comparison.json
β”‚
β”œβ”€β”€ πŸ“ security-policies/              # Security configurations
β”‚   β”œβ”€β”€ pod-security-policy.yaml       # Pod security
β”‚   β”œβ”€β”€ network-policies.yaml          # Network security
β”‚   └── policy-enforcement.yaml        # OPA Gatekeeper
β”‚
β”œβ”€β”€ πŸ“ compliance/                      # Compliance and audit
β”‚   β”œβ”€β”€ audit-report.sh                # Audit automation
β”‚   └── policy-enforcement.yaml        # Compliance policies
β”‚
β”œβ”€β”€ πŸ“ scripts/                        # Shared scripts
β”‚   β”œβ”€β”€ backup-cluster.sh              # Universal backup
β”‚   β”œβ”€β”€ restore-cluster.sh             # Universal restore
β”‚   β”œβ”€β”€ security-scan.sh               # Security scanning
β”‚   β”œβ”€β”€ performance-tuning.sh          # Performance optimization
β”‚   β”œβ”€β”€ cost-optimizer.sh              # Cost optimization
β”‚   β”œβ”€β”€ troubleshoot-cluster.sh        # Troubleshooting
β”‚   └── schedule-backups.sh            # Backup scheduling
β”‚
β”œβ”€β”€ πŸ“ test-suite/                     # Comprehensive testing
β”‚   β”œβ”€β”€ run-all-tests.sh              # Test automation
β”‚   β”œβ”€β”€ load-test.yml                 # Load testing config
β”‚   β”œβ”€β”€ curl-format.txt               # HTTP testing
β”‚   └── test-performance.sh           # Performance testing
β”‚
β”œβ”€β”€ πŸ“ .github/workflows/             # CI/CD pipelines
β”‚   β”œβ”€β”€ cluster-deployment.yml        # Main deployment pipeline
β”‚   β”œβ”€β”€ gitops-deployment.yml         # GitOps pipeline
β”‚   └── security-scan.yml             # Security automation
β”‚
β”œβ”€β”€ πŸ“ docs/                          # Documentation
β”‚   β”œβ”€β”€ comparison-guide.md           # EKS vs k3s comparison
β”‚   β”œβ”€β”€ deployment-guide.md           # Deployment instructions
β”‚   β”œβ”€β”€ troubleshooting-guide.md      # Troubleshooting help
β”‚   β”œβ”€β”€ security-hardening.md         # Security best practices
β”‚   β”œβ”€β”€ cost-optimization.md          # Cost management
β”‚   └── operational-runbooks.md       # Operation procedures
β”‚
β”œβ”€β”€ prerequisites-check.sh            # Prerequisites validation
β”œβ”€β”€ deploy-comparison-environment.sh  # Main deployment script
β”œβ”€β”€ manage-environments.sh            # Environment management
β”œβ”€β”€ README.md                         # Main project documentation
β”œβ”€β”€ CONTRIBUTING.md                   # Contribution guidelines
β”œβ”€β”€ LICENSE                           # Project license
└── .gitignore                        # Git ignore rules