How to stop an environment?


Once I run garden deploy, I wonder how can I stop the environment without deleting it?

I actually run a scale-down command that scales down all deployments to 0. I set up a custom garden command to do this. The command line itself looks something like:

kubectl --context=<your-context> scale --replicas=0  deployments -n ${ local.env.USER}-garden -l app

There is a converse scale-up command that sets all replicas to 1 (our default)

This leaves everything else intact, including pvcs, etc

edit: Here is the full scaledown command:

kind: Command
name: scale-down
  short: Be a good citizen and scale your project down when not in use
    - bash
    - -c
    - |
      kubectl --context=(your context) scale --replicas=0 deployments -n ${ local.env.USER}-garden -l app
      kubectl --context=(your context) scale --replicas=0 deployments -n ${ local.env.USER}-garden -l service

Note that you may build your namespace differently and may use different labels. You also need to provide a real context

1 Like