Description
Please select the type of request
Bug
Tell us more
Describe the Problem
I'm following the details here for pod autoscaling. It seems that spec.replicas
is a mandatory field, but with the HorizontalPodAutoscaler docs recommend that you remove spec.replicas
from the target manifest.
When an HPA is enabled, it is recommended that the value of spec.replicas of the Deployment and / or StatefulSet be removed from their manifest(s).
Error I receive when I remove spec.replicas
:
the HPA controller was unable to get the target's current scale: Internal error occurred: the spec replicas field ".spec.replicas" does not exist
Expected behavior
One should be able to remove spec.replicas
from the Splunk CR indexerclusters.enterprise.splunk.com
(and probably other CRs...) to allow HorizontalPodAutoscaler to manage the spec.replicas
.
Splunk setup on K8S
AWS EKS v1.29, with Splunk Operator 2.5.2.
Last thing to note, I'm using autoscaling/v2
apiVersion
Reproduction/Testing steps
idx-cluster.yaml:
---
apiVersion: enterprise.splunk.com/v4
kind: IndexerCluster
metadata:
name: idx-cluster
finalizers:
- enterprise.splunk.com/delete-pvc
spec:
imagePullPolicy: IfNotPresent
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: affinityNodeGroup
operator: In
values:
- splunk-nodegroup-indexers
tolerations:
- key: splunk-indexers
value: "true"
effect: NoExecute
serviceAccount: splunk-enterprise-serviceaccount
resources:
limits:
cpu: 15
memory: 60G
requests:
cpu: 13
memory: 57G
#replicas: 3
clusterManagerRef:
name: cm
licenseManagerRef:
name: lm
monitoringConsoleRef:
name: mc
etcVolumeStorageConfig:
ephemeralStorage: false
storageCapacity: 10Gi
storageClassName: gp3
varVolumeStorageConfig:
ephemeralStorage: false
storageCapacity: 800Gi
storageClassName: topolvm-local-ssd
HorizontalPodAutoscaler yaml:
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: idx-cluster-autoscaler
spec:
scaleTargetRef:
apiVersion: enterprise.splunk.com/v4
kind: IndexerCluster
name: idx-cluster
minReplicas: 3
maxReplicas: 10
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 50
K8s environment
k8s v1.29