ITADN

Allow omitting Deployment.spec.replicas for externally managed scaling

#1890Opensknmi 创建于 2026-06-14
status/0-needs-triage
S
sknmicommented
### Welcome! - [x] Yes, I've searched similar issues on [GitHub](https://github.com/traefik/traefik/issues) and didn't find any. - [x] Yes, I've searched similar issues on the [Traefik community forum](https://community.traefik.io) and didn't find any. ### What do you want to achieve with this Chart ? Since I can't reopen closed issue: https://github.com/traefik/traefik-helm-chart/issues/1864 I'll have to create a new one. I can't use this example (https://github.com/traefik/traefik-helm-chart/blob/master/EXAMPLES.md#install-with-argo-rollouts) because I want to completely disable HPA and use KEDA. (keda.sh) Here is example of my configuration: ``` deployment: replicas: null autoscaling: enabled: false extraObjects: - apiVersion: keda.sh/v1alpha1 kind: ScaledObject metadata: name: '{{ template "traefik.name" . }}' namespace: "{{ .Release.Namespace }}" spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment name: '{{ template "traefik.name" . }}' minReplicaCount: 3 maxReplicaCount: 50 fallback: failureThreshold: 3 replicas: 5 behavior: currentReplicasIfHigher advanced: horizontalPodAutoscalerConfig: behavior: scaleDown: stabilizationWindowSeconds: 300 policies: - type: Percent value: 25 periodSeconds: 60 triggers: - type: cpu metricType: Utilization metadata: value: "80" - type: prometheus metadata: serverAddress: http://monitoring-kube-prometheus-prometheus.monitoring.svc.cluster.local:9090 metricName: traefik_entrypoint_rps # desired replicas = ceil(total_rps / threshold) # 7d peak: ~19 RPS → threshold 20 defers to CPU; fast scale-down signal query: sum(rate(traefik_entrypoint_requests_total{entrypoint="websecure",job="traefik-metrics"}[2m])) threshold: "20" ignoreNullValues: "true" ``` In this setup, the Deployment’s spec.replicas field should be omitted from the rendered manifest so that KEDA becomes the sole owner of replica scaling. Many GitOps environments use Argo CD together with KEDA. Currently, the chart always renders spec.replicas when autoscaling.enabled=false. When an external KEDA ScaledObject manages the Deployment: KEDA updates Deployment.spec.replicas Argo CD detects drift from the Helm-rendered value Argo CD continuously reconciles the Deployment back to replicas: 1 KEDA scaling behavior is disrupted There are could be several solutions to this: When deployment.replicas is null, do not render the replicas field. Introduce a dedicated flag manageReplicas: false Introduce better integration with KEDA
0 条评论