https://github.com/epomatti/aks-autoscaler-metrics
HPA Metrics & Logging with AKS
https://github.com/epomatti/aks-autoscaler-metrics
aks autoscaler azure hpa kubernetes prometheus rust terraform
Last synced: 7 months ago
JSON representation
HPA Metrics & Logging with AKS
- Host: GitHub
- URL: https://github.com/epomatti/aks-autoscaler-metrics
- Owner: epomatti
- License: mit
- Created: 2022-06-03T04:19:38.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-06-06T14:07:23.000Z (over 3 years ago)
- Last Synced: 2025-01-17T18:44:42.456Z (9 months ago)
- Topics: aks, autoscaler, azure, hpa, kubernetes, prometheus, rust, terraform
- Language: HCL
- Homepage:
- Size: 133 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AKS Autoscaler Metrics
Observability and Auto Scaling for AKS with Terraform with the following logging and metrics configuration:
- Container Insights
- ContainerLogV2
- Log Analytics Workspace
- OMS Agent
- Monitoring Metrics PublisherContainer Insights live dashboard:

## Deploy
```sh
terraform -chdir='infrastructure' init
terraform -chdir='infrastructure' apply -auto-approve
```Once done get the credentials:
```sh
az aks get-credentials -n aks-icecream -g rg-icecream
```Test the metrics components:
```sh
# Confirm agent deployment
kubectl get ds omsagent --namespace=kube-system# Confirm solution deployment
kubectl get deployment omsagent-rs -n=kube-system
```Set Container Insights to use ContainerLogV2:
```sh
kubectl apply -f container-azm-ms-agentconfig.yaml
```Setup ContainerLogV2 to [Basic Logs](https://docs.microsoft.com/en-us/azure/azure-monitor/logs/basic-logs-configure?tabs=portal-1%2Cportal-2) to save costs.
```sh
az monitor log-analytics workspace table update --resource-group 'rg-icecream' --workspace-name 'log-icecream' --name 'ContainerLogV2' --plan 'Basic'
```Deploy to Kubernetes:
```sh
kubectl apply -f kubernetes.yaml
```Service should be running on the external address:
```sh
curl 'http://:30000/api/icecream/5'
```That's it 👍 services should be ready for load testing.
## Auto Scaling Load Testing
Check autoscaler status:
```
kubectl describe configmap --namespace kube-system cluster-autoscaler-statusAzureDiagnostics
| where Category == "cluster-autoscaler"
```To load test it with K6 on Docker:
```sh
docker run \
-e "CLUSTER_EXTERNAL_IP=" \
-e "API=/api/fibonacci/40" \
-e "VUS=10" \
-e "DURATION=300s" \
-e "K6_SLEEP=1" \
--rm -i grafana/k6 run -