Links

Pause & Resume Environments

Learn about Pause & Resume
Periodical and occasional Environments (e.g. Dev, QA, or ones dedicated to Customer Demos), or more specifically the Kubernetes clusters at the center of them, can amount to a significant portion of your cloud expenditure, even when they're not in use. Historically, scaling these Kubernetes clusters up and down to meet demand was impractical. The reason for this is that you needed to first scale down the workloads running on them to avoid unexpected errors and alerts. Pause & Resume removes this obstacle by making it easy to scale down (and up) all eligible Workloads in an Environment. Enabling you to easily scale either on-demand or automate it via the API.
In order for Workloads to be eligible for Pause & Resume they must be running under the default-module profile.

Pause an environment

Pausing an Environment records how many instances are currently configured, then scales all eligible Workloads down to Zero instances - Enabling your cluster scaling solution to safely adjust the number of Kubernetes nodes.
UI
API
CLI
Screenshot of the UI - App Details Screen. Highlighting the Pause buttons
There are a number of ways to Pause an Environment. The easiest being:
  1. 1.
    Go into App Details Screen of an App that is deployed to the Environment you wish to pause
  2. 2.
    Select the Environment's tile - (1) In the screenshot
  3. 3.
    Ensure that you're looking at an active deployment (not a draft).
  4. 4.
    Click the "Pause environment" button - Either (2) or (3) in the screenshot, depending on if you clicked the 3-dots menu or the card.
This will open a modal dialog asking you to confirm that you want to pause the environment.
Screenshot of the UI - App Details Screen. Showing the Pause confirmation Dialog
  1. 1.
    If you are happy to proceed press the "Pause environment" confirmation button
  1. 1.
    To Pause an Environment via the API, all you need is a single PUT request to the https://api.humanitec.io/orgs/{orgId}/apps/{appId}/envs/{envId}/runtime/paused endpoint.
You can read more about this endpoint in our API docs.
E.G.
export HUMANITEC_ORG="my-org"
export HUMANITEC_APP="my-app"
export HUMANITEC_ENV="my-environment"
export HUMANITEC_TOKEN="my-token"
curl -X PUT https://api.humanitec.io/orgs/${HUMANITEC_ORG}/apps/${HUMANITEC_APP}/envs/${HUMANITEC_ENV}/runtime/paused
-H 'Content-Type: application/json'
-H 'Authorization: Bearer ${HUMANITEC_TOKEN}'
-d 'true'
Our CLI is currently in closed beta. Please contact us if you want to learn more.
In order to return to this state later, Humanitec will record the number of instances for each Workload at the time that the Pause action is triggered. Once the state is recorded Humanitec will start scaling down the instances of each Workload.

Resume an environment

Resuming an Environment automatically scales all eligible Workloads back to the same number of instances configured when it was scaled down - This may trigger your cluster scaling solution to increase the number of Kubernetes nodes if there are insufficient resources available.
UI
API
CLI
Screenshot of the UI - App Details Screen. Highlighting the Resume buttons
There are a number of ways to Resume an Environment. The easiest being:
  1. 1.
    Go into App Details page of an App that is deployed to the Environment you wish to resume
  2. 2.
    Select the Environment's tile - (1) in the screenshot
  3. 3.
    Click the "Resume environment" button - Either (2) or (3) in the screenshot, depending on if you clicked the 3-dots menu or the card.
  1. 1.
    To Pause an Environment via the API, all you need is a single PUT request to the https://api.humanitec.io/orgs/{orgId}/apps/{appId}/envs/{envId}/runtime/paused endpoint.
You can read more about this endpoint in our API docs.
E.G.
export HUMANITEC_ORG="my-org"
export HUMANITEC_APP="my-app"
export HUMANITEC_ENV="my-environment"
export HUMANITEC_TOKEN="my-token"
curl -X PUT https://api.humanitec.io/orgs/${HUMANITEC_ORG}/apps/${HUMANITEC_APP}/envs/${HUMANITEC_ENV}/runtime/paused
-H 'Content-Type: application/json'
-H 'Authorization: Bearer ${HUMANITEC_TOKEN}'
-d 'false'
Our CLI is currently in closed beta. Please contact us if you want to learn more.
This will adjust the number of instances for each Workload, to match the number running at the time the environment was Paused. As mentioned earlier this may trigger the environment to scale up the number of nodes in your kubernetes cluster to fit the new resource allocation requirements.

RBAC

To Pause or Resume an Environment you will need to have the "Administrator" role within your Organization or hold either the "Owner" or the "Developer" role on the App together with being a "Deployer" for that environment type.
You can find out more about RBAC here.