Managing service resources
Working with defaults and overrides for resources
Both the default configuration and the environment-specific configuration include a resources
section, which contains resource defaults for:
CPU limits and requests (required)
Memory limits and requests (required)
Replicas (required)
Storage type and size
These resources are based on Kubernetes definitions of resources. You can read more about resources here.
Here is an example default resources stanza:
Overriding resources
You can override the resource defaults in the Application Template, either in the services
section or in the template for a particular environment.
Let's take a look at how to make the following changes to the defaults:
Add extra memory for a
frontend
service in all environments.Deploy two
backend
replicas in all environments.Specify five
backend
replicas and tenfrontend
replicas in our production environment.
For the examples that follow, the resources defaults look like this:
Add extra memory for a frontend
service in all environments
frontend
service in all environmentsIn the following snippet, we set memory limits
to 4Gi and requests
to 500Mi:
Now every environment will have a 4Gi memory limit and a 500Mi request value for each frontend
instance. Every other service instance will have a 2Gi memory limit and 100Mi request value.
Deploy two backend
replicas in all environments
backend
replicas in all environmentsIn the default environment configuration, override the default value for replicas
in the services
section for backend
:
Now every environment we deploy based on our default environment configuration will deploy two instances of the backend
service and one instance of each other service.
Specify five backend
replicas and ten frontend
replicas in our production environment
backend
replicas and ten frontend
replicas in our production environmentIn order to override resource defaults for our production environment, we need to create a production space and modify the environment-specific configuration.
Here's how we would set the number of replicas for frontend
and backend
:
By overriding the defaults for replicas in the environment-specific configuration, your production environment will deploy with ten frontend
and five backend
instances running in the cluster. These changes are specific to your production environment, so other environments will not be affected.
Last updated