Kf는 Kubernetes 수평형 pod 자동 확장 처리(HPA)를 활용하여 앱의 pod 수를 자동으로 확장합니다. 앱에 자동 확장이 사용 설정되면 HPA 객체가 생성되고 앱 객체에 바인딩됩니다. 그런 다음 대상 확장을 동적으로 계산하고 앱을 설정합니다.
Kf 확장의 작동 방식
Kf 앱을 위해 배포되는 pod 수는 기본 배포 객체의 replica 필드로 제어합니다. 배포 복제본의 대상 수는 앱의 replicas 필드를 통해 설정합니다.
kf scale 명령어를 사용하면 수동으로 확장할 수 있습니다. 대상 중복을 방지하기 위해 자동 확장을 사용 설정하면 이 명령어가 사용 중지됩니다.
Kubernetes 수평형 pod 자동 확장 처리 작동 방식
수평형 Pod 자동 확장 처리(HPA)는 Kubernetes API 리소스(HPA 객체)와 제어 루프(HPA 컨트롤러)로 구현되며, 현재 리소스 사용률에 따라 원하는 복제본 수를 주기적으로 계산합니다.
그런 다음 HPA 컨트롤러가 Scale 하위 리소스를 구현하는 대상 객체에 이 수를 전달합니다. 실제 확장은 기본 객체 및 해당 컨트롤러에 위임됩니다. 자세한 내용은 Kubernetes 문서를 참조하세요.
자동 확장 처리가 확장 시기를 결정하는 방법
HPA 컨트롤러는 각 HorizontalPodAutoscaler 정의에 지정된 측정항목을 기준으로 리소스 사용률을 쿼리합니다. 컨트롤러는 각 Pod의 리소스 Metrics API에서 측정항목을 가져옵니다. 그런 다음 컨트롤러가 사용률 값을 동등한 리소스 요청의 백분율로 계산합니다. 원하는 복제본 수는 현재 백분율과 원하는 백분율의 비율에 따라 계산됩니다. 자동 확장 알고리즘에 대한 자세한 내용은 Kubernetes 문서를 참조하세요.
측정항목
Kf는 CPU만 대상 측정항목으로 지원하는 HPA v1을 사용합니다.
Kubernetes 수평 자동 확장 처리가 Kf와 작동하는 방식
Kf 앱에 자동 확장이 사용 설정되면 Kf 컨트롤러는 앱에 지정된 확장 한도와 규칙에 따라 HPA 객체를 만듭니다. 그런 다음 HPA 컨트롤러가 HPA 객체에서 사양을 가져오고 그에 따라 앱을 확장합니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-04(UTC)"],[],[],null,["# Autoscaling\n\nKf leverages the Kubernetes Horizontal Pod Autoscaler (HPA)\nto automatically scale the number of Pods in a App. When autoscaling is enabled\nfor an App, an HPA object is created and bound to the App object. It then dynamically\ncalculates the target scale and sets it for the App.\n\nHow Kf scaling works\n--------------------\n\nThe number of Pods that are deployed for a Kf App is\ncontrolled by its underlying Deployment object's `replica` field. The target\nnumber of Deployment replicas is set through the App's `replicas` field.\n\nScaling can be done manually with the [`kf scale`](/migrate/kf/docs/2.1/cli/kf-scale)\ncommand. This command is disabled when autoscaling is enabled to avoid conflicting targets.\n\nHow the Kubernetes Horizontal Pod Autoscaler works\n--------------------------------------------------\n\nThe Horizontal Pod Autoscaler (HPA) is implemented as a Kubernetes API resource\n(the HPA object) and a control loop (the HPA controller) which periodically\ncalculates the number of desired replicas based on current resource utilization.\nThe HPA controller then passes the number to the target object that implements the\nScale subresource. The actual scaling is delegated to the underlying object and\nits controller. You can find more information in the [Kubernetes documentation](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/).\n\n### How the Autoscaler determines when to scale\n\nPeriodically, the HPA controller queries the resource utilization against\nthe metrics specified in each HorizontalPodAutoscaler definition. The controller\nobtains the metrics from the resource metrics API for each Pod. Then the\ncontroller calculates the utilization value as a percentage of the equivalent\nresource request. The desired number of replicas is then calculated based on the\nratio of current percentage and desired percentage. You can read more about the\n[autoscaling algorithm](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#algorithm-details) in the Kubernetes documentation.\n\n### Metrics\n\nKf uses HPA v1 which only supports CPU as the target\nmetric.\n\nHow the Kubernetes Horizontal Autoscaler works with Kf\n------------------------------------------------------\n\nWhen autoscaling is enabled for a Kf App, the Kf\ncontroller will create an HPA object based on the scaling limits and rules\nspecified on the App. Then the HPA controller fetches the specs from the HPA\nobject and scales the App accordingly.\n\nThe HPA object will be deleted if Autoscaling is disabled or if the\ncorresponding App is deleted."]]