# How to make HPA roll back the changes when it's deleted?

**URL:** <https://discuss.kubernetes.io/t/how-to-make-hpa-roll-back-the-changes-when-its-deleted/33734>\
**Category:** General Discussions\
**Tags:** development\
**Created:** [December 4, 2025, 6:05pm UTC](https://discuss.kubernetes.io/t/how-to-make-hpa-roll-back-the-changes-when-its-deleted/33734 "2025-12-04T18:05:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![fatherwilliam](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/fatherwilliam/32/17890_2.png) [@fatherwilliam](https://discuss.kubernetes.io/u/fatherwilliam)\
**Post date:** [December 4, 2025, 6:05pm UTC](https://discuss.kubernetes.io/t/how-to-make-hpa-roll-back-the-changes-when-its-deleted/33734/1 "2025-12-04T18:05:04Z")

</div>

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:

```auto
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
