HPA
1. Kubernetes ๊ด์ ์์์ HPA
2. Helm ๊ด์ ์์์ HPA
Last updated
Last updated
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
annotations:
meta.helm.sh/release-name: staging
meta.helm.sh/release-namespace: nestjs-boilerplate-config-variable
creationTimestamp: "2024-05-09T01:57:58Z"
labels:
app: staging
app.kubernetes.io/instance: staging
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: staging
chart: auto-deploy-app-2.80.1
helm.sh/chart: auto-deploy-app-2.80.1
heritage: Helm
release: staging
name: staging-auto-deploy
namespace: nestjs-boilerplate-config-variable
resourceVersion: "39297159"
uid: d5d40b25-453f-43f2-a3d3-35e5d174fdf9
spec:
maxReplicas: 10
metrics:
- resource:
name: cpu
target:
averageUtilization: 70
type: Utilization
type: Resource
minReplicas: 3
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: staging
status:
conditions:
- lastTransitionTime: "2024-05-09T01:58:13Z"
message: recommended size matches current size
reason: ReadyForNewScale
status: "True"
type: AbleToScale
- lastTransitionTime: "2024-05-09T01:58:29Z"
message: the HPA was able to successfully calculate a replica count from cpu resource
utilization (percentage of request)
reason: ValidMetricFound
status: "True"
type: ScalingActive
- lastTransitionTime: "2024-05-09T04:49:43Z"
message: the desired replica count is less than the minimum replica count
reason: TooFewReplicas
status: "True"
type: ScalingLimited
currentMetrics:
- resource:
current:
averageUtilization: 0
averageValue: 1m
name: cpu
type: Resource
currentReplicas: 3
desiredReplicas: 3
lastScaleTime: "2024-05-09T04:44:28Z"{{- if and .Values.hpa.enabled .Values.resources.requests -}}
{{- if .Values.hpa.metrics }}
apiVersion: autoscaling/v2
{{- else }}
apiVersion: autoscaling/v1
{{- end }}
kind: HorizontalPodAutoscaler
metadata:
name: {{ template "fullname" . }}
labels:
{{ include "sharedlabels" . | indent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ template "appname" . }}
minReplicas: {{ .Values.hpa.minReplicas }}
maxReplicas: {{ .Values.hpa.maxReplicas }}
{{- if .Values.hpa.metrics }}
metrics:
{{- toYaml .Values.hpa.metrics | nindent 2 }}
{{- else }}
targetCPUUtilizationPercentage: {{ .Values.hpa.targetCPUUtilizationPercentage }}
{{- end }}
{{- end}}hpa:
enabled: true
minReplicas: 2
maxReplicas: 10
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 80