Skip to content

add autoscaler for ingesters #182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## master / unreleased

* [FEATURE] Add autoscaler for ingesters #182
* [ENHANCEMENT] Use FQDN for memcached addresses #175

## 0.6.0 / 2021-06-28
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,12 @@ Kubernetes: `^1.19.0-0`
| ingester.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution[0].podAffinityTerm.topologyKey | string | `"kubernetes.io/hostname"` | |
| ingester.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution[0].weight | int | `100` | |
| ingester.annotations | object | `{}` | |
| ingester.autoscaling.behavior.scaleDown.selectPolicy | string | `"Disabled"` | Scaledown procedure varies, so automatic scaledown is disabled Ref: https://cortexmetrics.io/docs/guides/ingesters-scaling-up-and-down/#scaling-down |
| ingester.autoscaling.behavior.scaleUp.policies | list | `[{"periodSeconds":1800,"type":"Pods","value":1}]` | This default scaleup policy allows adding 1 pod every 30 minutes. Ref: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-configurable-scaling-behavior |
| ingester.autoscaling.enabled | bool | `false` | |
| ingester.autoscaling.maxReplicas | int | `30` | |
| ingester.autoscaling.minReplicas | int | `3` | |
| ingester.autoscaling.targetMemoryUtilizationPercentage | int | `80` | |
| ingester.containerSecurityContext.enabled | bool | `true` | |
| ingester.containerSecurityContext.readOnlyRootFilesystem | bool | `true` | |
| ingester.env | list | `[]` | |
Expand Down
2 changes: 2 additions & 0 deletions templates/ingester/ingester-dep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ metadata:
annotations:
{{- toYaml .Values.ingester.annotations | nindent 4 }}
spec:
{{- if not .Values.ingester.autoscaling.enabled }}
replicas: {{ .Values.ingester.replicas }}
{{- end }}
selector:
matchLabels:
{{- include "cortex.ingesterSelectorLabels" . | nindent 6 }}
Expand Down
29 changes: 29 additions & 0 deletions templates/ingester/ingester-hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{{- with .Values.ingester.autoscaling -}}
{{- if .enabled }}
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "cortex.ingesterFullname" $ }}
namespace: {{ $.Release.Namespace }}
labels:
{{- include "cortex.ingesterLabels" $ | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: {{ if $.Values.ingester.statefulSet.enabled }}StatefulSet{{ else }}Deployment{{ end }}
name: {{ include "cortex.ingesterFullname" $ }}
minReplicas: {{ .minReplicas }}
maxReplicas: {{ .maxReplicas }}
metrics:
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .targetMemoryUtilizationPercentage }}
{{- with .behavior }}
behavior:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}
2 changes: 2 additions & 0 deletions templates/ingester/ingester-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ metadata:
annotations:
{{- toYaml .Values.ingester.annotations | nindent 4 }}
spec:
{{- if not .Values.ingester.autoscaling.enabled }}
replicas: {{ .Values.ingester.replicas }}
{{- end }}
selector:
matchLabels:
{{- include "cortex.ingesterSelectorLabels" . | nindent 6 }}
Expand Down
18 changes: 18 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,24 @@ ingester:

annotations: {}

autoscaling:
enabled: false
minReplicas: 3
maxReplicas: 30
targetMemoryUtilizationPercentage: 80
behavior:
scaleDown:
# -- Scaledown procedure varies, so automatic scaledown is disabled
# Ref: https://cortexmetrics.io/docs/guides/ingesters-scaling-up-and-down/#scaling-down
selectPolicy: Disabled
scaleUp:
# -- This default scaleup policy allows adding 1 pod every 30 minutes.
# Ref: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-configurable-scaling-behavior
policies:
- type: Pods
value: 1
periodSeconds: 1800

## DEPRECATED: use persistentVolume.subPath instead
persistence:
subPath:
Expand Down