VPA - Vertical Pod Autoscaler
VPA는 Pod Resources.request를 최대한 최적값으로 수정
- VPA는 HPA와 같이 사용할 수 없습니다.
- VPA는 pod 자원을 최적값으로 수정하기 위해 pod를 재실행 (기존 pod를 종료하고 새로운 pod 실행)
- 계산 방식 : '기준값(파드가 동작하는데 필요한 최조한의 값)'을 결정 > '마진(약간의 적절한 버퍼)' 추가


VPA 프로세스
- VPA 구성
- 사용자는 VPA를 설정하여 target Deploy 또는 Pod의 리소스를 자동으로 조정하는 구성을 생성
- VPA recommender
- Metrics Server에서 pod의 리소스 사용량 데이터로 분석
- 분석 결과를 통해 최적의 CPU 와 메모리 requests 계산
- 계산된 추천값을 updater와 controller에 전달
- VPA Updater
- 추천된 리소스를 적용하기 위해 기존 pod를 삭제
- 새로운 리소스 값이 적용된 pod를 생성되도록 적용
- Pod가 삭제되면 Deployment가 requsts 값이 반영된 신규 pod를 생성 (이 과정에서 Admission Controller 개입)
## 그라파나 대시보드 import (14588)
## 운영 서버에서 코드 다운로드
git clone https://github.com/kubernetes/autoscaler.git
cd ~/autoscaler/vertical-pod-autoscaler/
tree hack
## openssl 버전 확인
openssl version
OpenSSL 1.0.2k-fips 26 Jan 2017
## openssl 버전 업데이트
yum remove openssl -y
yum install openssl11 -y
## 버전 확인
openssl11 version
OpenSSL 1.1.1zb 11 Feb 2025
## 명령어 적용
ln -s /usr/bin/openssl11 /usr/bin/openssl
## 모니터링
watch -d kubectl get pod -n kube-system
## vpa-up 실행
./hack/vpa-up.sh
## 확인
k get crd | grep autoscaling
k get mutatingwebhookconfigurations vpa-webhook-config
k get mutatingwebhookconfigurations vpa-webhook-config -o json | jq

## 모니터링
watch -d "kubectl top pod;echo "----------------------";kubectl describe pod | grep Requests: -A2"
## 예제 배포
cat examples/hamster.yaml
k apply -f examples/hamster.yaml
k get vpa -w
## 파드 리소스 Requests 확인
k describe pod | grep Requests: -A2





VPA는 CPU는 15%, MEM은 30%의 마진을 추가하여 추천하는 것이 기본값으로 설정되어 있으며,
90th 퍼센타일 기반으로 리소스를 계산하여, 급격한 트래픽 증가를 일시적으로라도 대응할 수 있도록 마진 설정
기본 마진 값의 변경이 필요한 경우라면 VerticalPodAutoscaler 값에서 변경
apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
name: example-vpa
spec:
resourcePolicy:
containerPolicies:
- containerName: '*'
minAllowed:
cpu: "100m"
memory: "200Mi"
maxAllowed:
cpu: "2"
memory: "4Gi"
controlledValues: RequestsAndLimits
updatePolicy:
updateMode: "Auto"
- minAllowed: 최소 허용 리소스
- maxAllowed: 최대 허용 리소스
- controlledValues: Request과 Limit 값 모두 조정할지 여부
- updateMode: 자동으로 조정할지 여부
'Cloud > AWS' 카테고리의 다른 글
[AWS] EKS Autoscaler - CPA (0) | 2025.03.09 |
---|---|
[AWS] EKS Autoscaler - CAS (0) | 2025.03.09 |
[AWS] EKS Autoscaling - KEDA (0) | 2025.03.08 |
[AWS] EKS AutoScaling - HPA (0) | 2025.03.08 |
[AWS] EKS Observability (1) | 2025.03.02 |
VPA - Vertical Pod Autoscaler
VPA는 Pod Resources.request를 최대한 최적값으로 수정
- VPA는 HPA와 같이 사용할 수 없습니다.
- VPA는 pod 자원을 최적값으로 수정하기 위해 pod를 재실행 (기존 pod를 종료하고 새로운 pod 실행)
- 계산 방식 : '기준값(파드가 동작하는데 필요한 최조한의 값)'을 결정 > '마진(약간의 적절한 버퍼)' 추가


VPA 프로세스
- VPA 구성
- 사용자는 VPA를 설정하여 target Deploy 또는 Pod의 리소스를 자동으로 조정하는 구성을 생성
- VPA recommender
- Metrics Server에서 pod의 리소스 사용량 데이터로 분석
- 분석 결과를 통해 최적의 CPU 와 메모리 requests 계산
- 계산된 추천값을 updater와 controller에 전달
- VPA Updater
- 추천된 리소스를 적용하기 위해 기존 pod를 삭제
- 새로운 리소스 값이 적용된 pod를 생성되도록 적용
- Pod가 삭제되면 Deployment가 requsts 값이 반영된 신규 pod를 생성 (이 과정에서 Admission Controller 개입)
## 그라파나 대시보드 import (14588)
## 운영 서버에서 코드 다운로드
git clone https://github.com/kubernetes/autoscaler.git
cd ~/autoscaler/vertical-pod-autoscaler/
tree hack
## openssl 버전 확인
openssl version
OpenSSL 1.0.2k-fips 26 Jan 2017
## openssl 버전 업데이트
yum remove openssl -y
yum install openssl11 -y
## 버전 확인
openssl11 version
OpenSSL 1.1.1zb 11 Feb 2025
## 명령어 적용
ln -s /usr/bin/openssl11 /usr/bin/openssl
## 모니터링
watch -d kubectl get pod -n kube-system
## vpa-up 실행
./hack/vpa-up.sh
## 확인
k get crd | grep autoscaling
k get mutatingwebhookconfigurations vpa-webhook-config
k get mutatingwebhookconfigurations vpa-webhook-config -o json | jq

## 모니터링
watch -d "kubectl top pod;echo "----------------------";kubectl describe pod | grep Requests: -A2"
## 예제 배포
cat examples/hamster.yaml
k apply -f examples/hamster.yaml
k get vpa -w
## 파드 리소스 Requests 확인
k describe pod | grep Requests: -A2





VPA는 CPU는 15%, MEM은 30%의 마진을 추가하여 추천하는 것이 기본값으로 설정되어 있으며,
90th 퍼센타일 기반으로 리소스를 계산하여, 급격한 트래픽 증가를 일시적으로라도 대응할 수 있도록 마진 설정
기본 마진 값의 변경이 필요한 경우라면 VerticalPodAutoscaler 값에서 변경
apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
name: example-vpa
spec:
resourcePolicy:
containerPolicies:
- containerName: '*'
minAllowed:
cpu: "100m"
memory: "200Mi"
maxAllowed:
cpu: "2"
memory: "4Gi"
controlledValues: RequestsAndLimits
updatePolicy:
updateMode: "Auto"
- minAllowed: 최소 허용 리소스
- maxAllowed: 최대 허용 리소스
- controlledValues: Request과 Limit 값 모두 조정할지 여부
- updateMode: 자동으로 조정할지 여부
'Cloud > AWS' 카테고리의 다른 글
[AWS] EKS Autoscaler - CPA (0) | 2025.03.09 |
---|---|
[AWS] EKS Autoscaler - CAS (0) | 2025.03.09 |
[AWS] EKS Autoscaling - KEDA (0) | 2025.03.08 |
[AWS] EKS AutoScaling - HPA (0) | 2025.03.08 |
[AWS] EKS Observability (1) | 2025.03.02 |