Hi all,
There is a straightforward use case: a new one-replica deploy created as
kubectl create deploy test-metrics --image=nginx --replicas=1
followed by applying the next HPA:
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: just-hpa
namespace: default
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: test-metrics
minReplicas: 11
maxReplicas: 20
metrics:
- type: Pods
pods:
metric:
name: requests_per_second
target:
type: AverageValue
averageValue: "1
It led to the immediate growth of the number of pods to 11, as expected.
However, when I deleted the HPA, the number of pods stayed the same because as I found the hpa edited the ReplicaSet of the deployment.
Is there any way to make hpa when it’s deleting to roll back changes?
Thank you!
Cluster information:
Kubernetes version: 1.31
Cloud being used: qemu instances
Installation method: kubeadm
Host OS: Ubuntu 22