![](https://i0.wp.com/sp-ao.shortpixel.ai/client/to_auto,q_lossy,ret_img,w_1200/https://www.peppoj.net/wp-content/uploads/2022/09/Kubernetes_logo.png?resize=523%2C508&ssl=1)
Kubernetes deployments are funny. For every kubectl rollout restart deployment (or it’s API equivalent), there is a new -empty- statefulset…
If you want to take a look, run the following:
kubectl get replicaset -o jsonpath='{ .items[?(@.spec.replicas==0)].metadata.name }'
Quite allot huh?
Clean them up with:
kubectl delete replicaset $(kubectl get replicaset -o jsonpath='{ .items[?(@.spec.replicas==0)].metadata.name }')
To prevent a new empty replicaset for every new deployment, add:
revisionHistoryLimit: 0
To your deployment, this will prevent each new rollout creating up to the default ten (!!!) new replicasets.
Good luck ?