AWS EKS 환경에서 Prometheus, HPA, Cluster Autoscaler를 활용하여 효율적인 Autoscaling을 구현
# **bank-app-back-hpa.yaml**
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: hpa-backend-server
namespace: bank-namespace
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: backend-server
minReplicas: 1
maxReplicas: 3
metrics:
- type: Pods
pods:
metric:
name: node_namespace_pod_container:container_cpu_usage_seconds_total:sum_irate
target:
type: AverageValue
averageValue: 0.3
- type: Pods
pods:
metric:
name: container_memory_usage_bytes
target:
type: AverageValue
averageValue: 524288000
- type: Pods
pods:
metric:
name: container_network_receive_bytes_total
target:
type: AverageValue
averageValue: 1000000
- type: Pods
pods:
metric:
name: container_network_transmit_bytes_total
target:
type: AverageValue
averageValue: 1000000
node_namespace_pod_container:container_cpu_usage_seconds_total:sum_irate 메트릭을 기준으로 Pod 확장 조건을 설정container_memory_usage_bytes 메트릭을 활용하여 메모리 사용량이 일정 수준 이상일 때 Pod 확장container_network_receive_bytes_total와 container_network_transmit_bytes_total 메트릭을 사용하여 Pod의 네트워크 트래픽을 모니터링하고, 네트워크 사용량이 설정된 임계값을 넘을 경우 Pod를 자동으로 확장
