This part of the repository complements the AWS EKS Cluster creation by adding policies to specifiy the scaling behavior of the EC2 Cluster Autoscaling groups. Per default (using the EKS creation module) node groups are created as EC2 Autoscaling Groups. Thereby, already a minimum, maximum, and desired amount of nodes are specified per node group. In order to enable the automatic scaling, policies that define CPU and memory utilization thresholds are defined.
NOTE 1
This part of the project only covers utilization thesholds. Scaling up the cluster when nodes run out of capacity to schedule new nodes is implemented via a Cluster Autoscaler
NOTE 2
EC2 Auto Scaling Groups are implicitly created by the EKS module. Names or tags are not yet available, therefore the resulting name has to be manually inserted here (see step 1 of setup).
The EKS cluster creation prints the names as output variables within the command line tool after a successful cluster creation. Alternatively, the names can be obtained from the AWS console.
- Provisioned EKS Cluster: Baseline Architecture.
- Names of Auto Scaling Groups (Will be displayed after successful creation of the EKS cluster creation script).
- Insert the names of the Auto Scaling Groups in the variables.tf (Marked as output within the CMD, alternatively obtain from AWS console.)
- [Optional] adjust the CPU utilization if required.
- Open a CMD / navigate into this directory.
- Initialize the repo:
Terraform init
. This initializes the working directory by installing plugins and the modules created in the project structure. - [Optional] Plan the deployment:
Terraform plan
. This indicates how many resources are to be created and if any errors are present. - Deploy the cluster:
Terraform apply
confirm withyes
.
- Connect to the cluster
aws eks --region us-east-2 update-kubeconfig --name eks-cluster
- Deploy the application: ALB.
The TeaStore application already provides load testing scripts for Apache Apache JMeter. To test the scaling functionality:
- Install JMeter (Installtion)
- Open the GUI (bin/apacheJmeter.jar)
- Open JMeter file
- Adjust the webpage endpoint (DNS of Load Balancer) (Call
kubectl get services
-> External IP of teastore-webui ) - Start Thread group 3 (including several http requests)
- Monitor via kubectl get nodes
- Stop the load testing
- Remove the application via
kubectl delete -f TeaStore\teastore-alb.yaml
. From within the baseline-architecture directory. - Run
Terraform destroy
confirm withyes
(In the current directory, to only destroy the policy resource). - Destroy EKS cluster from within the baseline architecture directory, via
Terraform destroy
and confirm withyes
.