2 Answers
- Newest
- Most votes
- Most comments
0
Hello there, At this time, this isn't something that Karpenter natively handles. Karpenter works to actively reduce cluster cost by identifying when Nodes can be removed because the node is empty. You might consider the following options:
- Implement a cron job which scales down/up all deployments in the cluster based on your defined timing then Karpenter removes the nodes. Scale down to empty the nodes.
- Consider cluster autoscaler for your autoscaling needs. You can then configure scheduled scaling for the Amazon EC2 Auto Scaling to scale down your node group to zero when you don't need them and scale up the node group again when you need them.
Solutions like cluster-turndown and kube-downscaler can scale down the replicas to zero based on a cron schedule.
0
Hi,
This articles describes what you are looking for: https://www.blinkops.com/blog/how-to-scale-down-aws-eks-clusters-nightly-to-lower-ec2-costs
The full procedure is very detailed.
Best,
Didier
How does it help in case of karpenter?
Relevant content
asked 10 months ago
asked 3 years ago
asked a year ago

Even if we scale down the deployment to 0 does it scale down the nodes to zero because there must be few kubernetes related pods still running. Are you sure that will work?
Yes, it will scale down the nodes. One thing to note, make sure your cronjob runs on Fargate node or a dedicated manage node group so that the cronjob pods can always be scheduled. Some steps to have in mind
If you have daemonsets on the nodes, and you don't want to delete them, one possible tip would to use temporary nodeSelector with any non-existing label, for scale-in example:
kubectl -n <namespace> patch daemonset <name-of-daemon-set> -p '{"spec": {"template": {"spec": {"nodeSelector": {"non-existing": "true"}}}}}'For scale-out example:
kubectl -n <namespace> patch daemonset <name-of-daemon-set> --type json -p='[{"op": "remove", "path": "/spec/template/spec/nodeSelector/non-existing"}]'