The #1 Cloud cost-saving practise

It’s very simple. If you aren’t using it > turn it off.

In Cloud projects we have various different Environments that are used for plenty of different reasons. Many of these Environments are Pre-Production. Each Environment can be used for various different Testing and Experimentation to ensure that the work we deliver to Production is of high quality.

But unlike Production, these Delivery environments do not need to be up at all times. Infact, many are only used 9 to 5, Monday to Friday. And others are used even less than this!

Computing costs for Memory and CPU reserved by Pods are often one of the highest service costs one will incur from any Cloud Provider. Simple sleep Scheduling can cut this cost in half at least!

Implementation Options

Delete your Deployments at the end of each day and Re-Deploy each morning. Configure a tool to Schedule a scaledown from within the cluster (https://github.com/hjacobs/kube-downscaler). Run a Scaledown job on a Cron Schedule from your Automation Server e.g Jenkins.

I elect option 3.

No learning curve as team members already have the knowledge required inherently.

The K8s code is very simple:

for all namespaces

for all deployments

kubectl scale deployment <deployment-name> --repliacs=0

You do not need to manage Namespace State by re-deploying the exact same versions as the previous day.

No need to run many different Deployment jobs.

Important Implementation Tips

Set jobs for all Environments at once so that you don’t forget. Tailor the job and process to each Environment.

It is most cost-efficient to change the scaledown Requirements on an Environment by Environment basis. Some Environments may need to be up at night or on weekends. Some should almost always be scaled-down and only brought up on demand. This is where you need clear process defined to ensure that the Environment is cleared down again after use.