Hi everyone , i am having a challenge to automate scale down a statefulset to 0 . . .

Faseehulla:
Hi everyone , i am having a challenge to automate scale down a statefulset to 0 after 24 Hours. is there a way to do that ? Iam aware of HPA , VPA… but they are based on metrics. I need to scale it based on time duration . The requirement is to scale down pgadmin after 24hours of runtime …

Mohamed Ayman:
Hi @Faseehulla,
Use kubectl to scale StatefulSets
First, find the StatefulSet you want to scale.

kubectl get statefulsets <stateful-set-name>

Change the number of replicas of your StatefulSet:

kubectl scale statefulsets <stateful-set-name> --replicas=<new-replicas>

you can add the previous command to cronjob to run after 24 hours.