728x90
CPA - Cluster ProPortional Autoscaler
노드 수 증가에 비례하여 성능 처리가 필요한 어플리케이션(컨테이너/파드)를 수평으로 자동 확장

## helm repo 추가
helm repo add cluster-proportional-autoscaler https://kubernetes-sigs.github.io/cluster-proportional-autoscaler
## CPA 규칙을 설정하고 helm 차트 릴리즈
helm upgrade --install cluster-proportional-autoscaler cluster-proportional-autoscaler/cluster-proportional-autoscaler
## nginx 배포
cat <<EOT > cpa-nginx.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:latest
resources:
limits:
cpu: "100m"
memory: "64Mi"
requests:
cpu: "100m"
memory: "64Mi"
ports:
- containerPort: 80
EOT
k apply -f cpa-nginx.yaml
## CPA 규칙 설정
cat <<EOF > cpa-values.yaml
config:
ladder:
nodesToReplicas:
- [1, 1]
- [2, 2]
- [3, 3]
- [4, 3]
- [5, 5]
options:
namespace: default
target: "deployment/nginx-deployment"
EOF
k describe cm cluster-proportional-autoscaler ## 안나옴
## 모니터링
watch -d kubectl get pod
## helm upgrade
helm upgrade --install cluster-proportional-autoscaler -f cpa-values.yaml cluster-proportional-autoscaler/cluster-proportional-autoscaler
## node 5개로 증가
export ASG_NAME=$(aws autoscaling describe-auto-scaling-groups --query "AutoScalingGroups[? Tags[? (Key=='eks:cluster-name') && Value=='myeks']].AutoScalingGroupName" --output text)
aws autoscaling update-auto-scaling-group --auto-scaling-group-name ${ASG_NAME} --min-size 5 --desired-capacity 5 --max-size 5
aws autoscaling describe-auto-scaling-groups --query "AutoScalingGroups[? Tags[? (Key=='eks:cluster-name') && Value=='myeks']].[AutoScalingGroupName, MinSize, MaxSize,DesiredCapacity]" --output table
## node 4개로 축소
aws autoscaling update-auto-scaling-group --auto-scaling-group-name ${ASG_NAME} --min-size 4 --desired-capacity 4 --max-size 4
aws autoscaling describe-auto-scaling-groups --query "AutoScalingGroups[? Tags[? (Key=='eks:cluster-name') && Value=='myeks']].[AutoScalingGroupName, MinSize, MaxSize,DesiredCapacity]" --output table
[node 5개로 확장]


[node 4개로 축소]


Node가 삭제될 때 이전에 배포된 node를 삭제해 개수를 더 줄였더니, 실제로 Old node 부터 삭제하고,
신규 노드를 남겨 놓는 것으로 확인했습니다.


728x90
'Cloud > AWS' 카테고리의 다른 글
[AWS] EKS Security (0) | 2025.03.13 |
---|---|
[AWS] EKS Autoscaler - Karpenter (0) | 2025.03.09 |
[AWS] EKS Autoscaler - CAS (0) | 2025.03.09 |
[AWS] EKS Autoscaling - VPA (0) | 2025.03.08 |
[AWS] EKS Autoscaling - KEDA (0) | 2025.03.08 |
728x90
CPA - Cluster ProPortional Autoscaler
노드 수 증가에 비례하여 성능 처리가 필요한 어플리케이션(컨테이너/파드)를 수평으로 자동 확장

## helm repo 추가
helm repo add cluster-proportional-autoscaler https://kubernetes-sigs.github.io/cluster-proportional-autoscaler
## CPA 규칙을 설정하고 helm 차트 릴리즈
helm upgrade --install cluster-proportional-autoscaler cluster-proportional-autoscaler/cluster-proportional-autoscaler
## nginx 배포
cat <<EOT > cpa-nginx.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:latest
resources:
limits:
cpu: "100m"
memory: "64Mi"
requests:
cpu: "100m"
memory: "64Mi"
ports:
- containerPort: 80
EOT
k apply -f cpa-nginx.yaml
## CPA 규칙 설정
cat <<EOF > cpa-values.yaml
config:
ladder:
nodesToReplicas:
- [1, 1]
- [2, 2]
- [3, 3]
- [4, 3]
- [5, 5]
options:
namespace: default
target: "deployment/nginx-deployment"
EOF
k describe cm cluster-proportional-autoscaler ## 안나옴
## 모니터링
watch -d kubectl get pod
## helm upgrade
helm upgrade --install cluster-proportional-autoscaler -f cpa-values.yaml cluster-proportional-autoscaler/cluster-proportional-autoscaler
## node 5개로 증가
export ASG_NAME=$(aws autoscaling describe-auto-scaling-groups --query "AutoScalingGroups[? Tags[? (Key=='eks:cluster-name') && Value=='myeks']].AutoScalingGroupName" --output text)
aws autoscaling update-auto-scaling-group --auto-scaling-group-name ${ASG_NAME} --min-size 5 --desired-capacity 5 --max-size 5
aws autoscaling describe-auto-scaling-groups --query "AutoScalingGroups[? Tags[? (Key=='eks:cluster-name') && Value=='myeks']].[AutoScalingGroupName, MinSize, MaxSize,DesiredCapacity]" --output table
## node 4개로 축소
aws autoscaling update-auto-scaling-group --auto-scaling-group-name ${ASG_NAME} --min-size 4 --desired-capacity 4 --max-size 4
aws autoscaling describe-auto-scaling-groups --query "AutoScalingGroups[? Tags[? (Key=='eks:cluster-name') && Value=='myeks']].[AutoScalingGroupName, MinSize, MaxSize,DesiredCapacity]" --output table
[node 5개로 확장]


[node 4개로 축소]


Node가 삭제될 때 이전에 배포된 node를 삭제해 개수를 더 줄였더니, 실제로 Old node 부터 삭제하고,
신규 노드를 남겨 놓는 것으로 확인했습니다.


728x90
'Cloud > AWS' 카테고리의 다른 글
[AWS] EKS Security (0) | 2025.03.13 |
---|---|
[AWS] EKS Autoscaler - Karpenter (0) | 2025.03.09 |
[AWS] EKS Autoscaler - CAS (0) | 2025.03.09 |
[AWS] EKS Autoscaling - VPA (0) | 2025.03.08 |
[AWS] EKS Autoscaling - KEDA (0) | 2025.03.08 |