Deployment Template
Introduction​

In Devtron, a Deployment Template defines how your application should run by defining its specifications. Devtron uses Helm charts to manage these deployments, allowing you to control everything from Resource Allocation to environment variables.
You can use default Deployment Charts provided by Devtron or Custom Deployment Charts developed by a super-admin to suit your needs.
This guide covers how to:
Select a Deployment Chart Type​
Users need to have Admin role or above to select a chart.
- Go to the Configurations page of your application.

- Click Base Configuration → Deployment Template.

- Select the Chart drop-down box. The following tabs are displayed:
-
Charts by Devtron - Displays the default deployment charts provided by Devtron
-
Custom charts - Displays your custom deployment charts (if available). To create a custom deployment chart, refer to Deployment Charts.


After you select and save a chart type for a given application, you won't be able to change it later. Make sure to choose the correct chart type before saving.
Choose a Chart Version​
Users need to have Admin role or above to select a chart version.
Devtron maintains multiple chart versions for each chart type. Additionally, each chart version has a supporting README file that you can use to know more about the features and variables.

Once you select a deployment chart, choose a chart version with which you wish to deploy your application from the Version drop-down box. By default, the latest version of the helm chart is selected.

Configure the Deployment Template​
Users need to have Admin role or above to configure a deployment template. However, super-admins can lock keys in deployment template to prevent non-super-admins from modifying them. Refer Lock Deployment Configuration to know more.
You can edit a deployment template using the following two ways:
Using GUI​
If you prefer to use a simple way to configure your chosen deployment chart, select GUI.

By default, the following fields are commonly available for you to modify in the GUI section of most charts:
| Fields | Description |
|---|---|
| Container Port | The internal port on which the container listens for HTTP requests. Specify the container port and optionally the service port that maps to it. |
| Resources | Here, you can tweak the requests and limits of the CPU resource and RAM resource as per the application. |
| Autoscaling | Define the autoscaling parameters to automatically scale your application's deployment based on resource utilization.
|
| Replica Count | Defines the number of pod replicas to be deployed for the application. Adjusting this value helps scale the application horizontally. |
| Ingress | Enable the Ingress to control external access to the application using HTTP/HTTPS routes. You can define hostnames, paths, and ingress class settings. By default, it is in the disabled state.
|
| Environment Variables (Key/Value) | Define key/value by clicking Add variable.
|
| Readiness Probe | Define the readiness probe to determine when a container is ready to start accepting traffic.
|
| Liveness Probe | Define the liveness probe to check if the container is still running and to restart it if it is not.
|
| Service | Configure the service that exposes your application to the network.
|
| serviceAccount | Specify the service account for the deployment to use, allowing it to access Kubernetes API resources.
|
| podDisruptionBudget | Ensure high availability by setting limits on how many pods can be disrupted at a time during voluntary disruptions like maintenance or updates. |
| Spec | Define node selection rules using key-value pairs. This ensures that the pod runs on specific nodes that match your given labels. |
| Tolerations | Define tolerations to allow the pods to be scheduled on nodes with matching taints.
|
| Image | Defines the container image to be used for deployment, including its pull policy (e.g., IfNotPresent, Always, Never) |
| Arguments | Enable the Arguments to pass one or more argument values. By default, it is in the disabled state. |
| Command | Enable the Command to pass one or more command values (e.g., /bin/sh -c "/app/custom-script.sh"). By default, it is in the disabled state. |
| imagePullSecrets | Provide secrets to authenticate and pull container images from a private registry. |
If you wish to perform additional configurations, click the Switch to Advanced button or YAML button. Or perform a dry run before saving your configuration.

-
If you change any values in the GUI, then the corresponding values will change in YAML too.
-
Users who are not super-admins will land on GUI section when they visit Deployment Template page; whereas super-admins will land on YAML section. This is just a default behavior, they can still navigate to the other section if needed.
Customize the GUI
​
Only a Super-Admin can customize the GUI section.
By default, the GUI section comes with multiple predefined fields as seen earlier in the table. However, if you wish to display a different set of fields to your team, you can modify the whole section as per your requirement.
This is useful in scenarios where:
-
Your team members find it difficult to understand and edit the YAML section.
-
You frequently edit certain fields in YAML, which you expect to remain easily accessible in GUI section.
-
You don't require some fields in GUI section.
-
You need the autonomy to keep the GUI unique for applications/clusters/environments/charts, or display the same GUI everywhere.
There are two ways you can customize the GUI, use any one of the following:
-
From Deployment Charts section
-
Using APIs (explained below)
You can pass a custom JSON (deployment schema) of your choice through the following API. You may need to run the API with the POST method if you are doing it for the first time.
PUT {{DEVTRON_BASEURL}}/orchestrator/deployment/template/schema
{
"name": "schema-1",
"type": "JSON",
"schema": "{\"type\":\"object\",\"properties\":{\"args\":{\"type\":\"object\",\"title\":\"Arguments\",\"properties\":{\"value\":{\"type\":\"array\",\"items\":{\"type\":\"string\"},\"title\":\"Value\"},\"enabled\":{\"type\":\"boolean\",\"title\":\"Enabled\"}}},\"command\":{\"type\":\"object\",\"title\":\"Command\",\"properties\":{\"value\":{\"type\":\"array\",\"items\":{\"type\":\"string\"},\"title\":\"Value\"},\"enabled\":{\"type\":\"boolean\",\"title\":\"Enabled\"}}},\"resources\":{\"type\":\"object\",\"title\":\"Resources(CPU&RAM)\",\"properties\":{\"limits\":{\"type\":\"object\",\"required\":[\"cpu\",\"memory\"],\"properties\":{\"cpu\":{\"type\":\"string\"},\"memory\":{\"type\":\"string\"}}},\"requests\":{\"type\":\"object\",\"properties\":{\"cpu\":{\"type\":\"string\"},\"memory\":{\"type\":\"string\"}}}}},\"autoscaling\":{\"type\":\"object\",\"title\":\"Autoscaling\",\"properties\":{\"MaxReplicas\":{\"type\":[\"integer\",\"string\"],\"title\":\"MaximumReplicas\",\"pattern\":\"^[a-zA-Z0-9-+\\\\/*%_\\\\\\\\s]+$\"},\"MinReplicas\":{\"type\":[\"integer\",\"string\"],\"title\":\"MinimumReplicas\",\"pattern\":\"^[a-zA-Z0-9-+\\\\/*%_\\\\\\\\s]+$\"},\"TargetCPUUtilizationPercentage\":{\"type\":[\"integer\",\"string\"],\"title\":\"TargetCPUUtilizationPercentage\",\"pattern\":\"^[a-zA-Z0-9-+\\\\/*%_\\\\\\\\s]+$\"},\"TargetMemoryUtilizationPercentage\":{\"type\":[\"integer\",\"string\"],\"title\":\"TargetMemoryUtilizationPercentage\",\"pattern\":\"^[a-zA-Z0-9-+\\\\/*%_\\\\\\\\s]+$\"}}},\"EnvVariables\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"key\":{\"type\":\"string\"},\"value\":{\"type\":\"string\"}}},\"title\":\"EnvironmentVariables\"},\"ContainerPort\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"port\":{\"type\":\"integer\"}}},\"title\":\"ContainerPort\"}}}",
"selectors": [
{
"attributeSelector": {
"category": "APP",
"appNames": ["my-demo-app"]
}
},
{
"attributeSelector": {
"category": "ENV",
"envNames": ["env1", "env2", "env3"]
}
},
{
"attributeSelector": {
"category": "CLUSTER",
"clusterNames": ["cluster1", "cluster2", "cluster3"]
}
},
{
"attributeSelector": {
"category": "CHART_REF",
"chartVersions": [
{
"type": "Deployment",
"version": "1.0.0"
}
]
}
},
{
"attributeSelector": {
"category": "APP_ENV",
"appEnvNames": [
{
"appName": "my-demo-app",
"envName": "devtron"
}
]
}
}
]
}
-
In the
namefield, give a name to your schema, e.g., schema-1 -
Enter the
typeas JSON. -
The
schemafield is for entering your custom JSON representing the deployment template's GUI. You can customize the fields that are displayed in the GUI section while configuring the deployment template. Perform the following steps:
-
To create a custom JSON for your deployment, you may use RJSF JSON Schema Tool.
-
Copy the final JSON and stringify it using any free online tool.
-
Paste the stringified JSON in the
schemafield of the API request body. -
Send the API request. If your schema already exists, use the
PUTmethod instead ofPOSTin the API call.
-
The
attributeSelectorobject helps you choose the scope at which your custom JSON will take effect.Priority Category Scope Description 1 (High) APP_ENV Specific to an application and its environment 2 APP Applies at the application level if no specific environment is defined 3 ENV Applies to specific deployment environment 4 CHART_REF Applies to all applications using a specific chart type and version 5 CLUSTER Applies across all applications and environments within a specific cluster 6 GLOBAL Universally applies if no other more specific schemas are defined
Using YAML​
If you prefer to perform additional configurations in your chosen deployment template, select YAML.

Every chart version has its own YAML file that provides specifications for your application. To make it easy to use, we have created templates for the YAML file and added some variables inside the YAML. You can provide or change the values of these variables as per your requirement.
Refer the respective templates to view the YAML details.
Before saving your configuration in YAML, make sure to perform a dry run.
Enable Application Metrics​
The availability of application metrics depends on the selected chart type and version. If supported, you can view key performance metrics such as:
- Status codes (2xx, 3xx, 5xx)
- Throughput
- Latency
- And more
To enable this, turn on the Show application metrics toggle.

Once enabled, you can view the application metrics on the App Details page.

Enabling application metrics adds a sidecar container to your main container, which may require additional configuration. We recommend running a load test in a non-production environment before enabling it in production.
Perform a Dry Run​
Before saving your configured deployment template, you can use the Dry Run option (as shown below) to preview the final Kubernetes manifests.
This feature helps you verify your configurations, detect issues, and ensure correctness before actual deployment.

Your configurations will appear in the left pane, while the right pane will display a section named Manifest generated from merged showing the computed Kubernetes manifests, each representing a separate resource after merging all your changes.
Edit a Protected Deployment Template
​
Only a super-admin, manager, and admin can edit the configuration values.
Any changes made to the deployment template will require approval if an approval policy is enforced. To check if your deployment template is protected, check the stamp/approve symbol as shown below.

Request Approval for Changes​
Let's assume you are the application admin and your deployment template in Base Configurations is protected from edits.
-
In the YAML editor of the deployment template, modify the values.

-
You can change the value of a key to a desired value as shown below. Once done, click the Save Changes button.

You cannot modify locked keys in deployment template unless you are a super-admin. Refer Lock Deployment Configuration to know more.
-
Since the deployment configuration is protected, your changes won't be published right away. You can do either of the following:
-
Save as draft : Selecting this option will save your file as a draft. You and other users can view and edit the saved draft and propose it further for approval.
-
Save & Propose Changes : Selecting this option will allow you to choose and notify the configuration approver(s) and propose your changes for a review. Moreover, it also has the option to notify all the users having access to the application on Devtron.
Since we are proposing the changes immediately, click Propose Changes.

-
-
You can also view the approval status if you wish.

No, the one who performs the edits cannot approve their own changes. A different user has to review and approve.
Only one draft can exist at time and you cannot create multiple drafts. In the top-right corner, you have the option to discard the draft if you don't wish to proceed with the edits you made.

Grant Approval for Changes​
Only a valid approver or a Super-Admin can approve the changes made to the deployment configuration. Refer to Approval Policy for more information.
Go to the edited configuration file to review and approve the changes as shown below.

If SES/SMTP is configured in Devtron, the approver gets notified via email. Therefore, the approver can take an action directly from the mail as shown below. Once the approver validates and approves your configuration changes, you can proceed to deploy your application with the updated configuration.