Skip to main content
Version: 2.0 🆕

Manage Environments

Environments allow you to structure your deployment stages inside Devtron by mapping logical stages like dev, QA, staging, or production to actual namespaces within your clusters. Once a cluster is added, you can create environments, define their type, attach labels, and assign categories for cleaner filtering. This page explains how to add, edit, and delete environments.

Add Environment to a Cluster

Who Can Perform This Action?

Users need to have super-admin permission to add an environment to a cluster.

After adding a cluster to Devtron (existing Kubernetes cluster, Isolated cluster, or a newly created cluster), initially it has no environments.

  1. Select the cluster to which you want to add an Environment and click Add Environment. Alternatively you can also hover over the cluster and click + icon (Add Environment icon); an Add Environment modal window appears.

Figure 1a: Adding an Environment

Figure 1b: Clicking 'Add Environment'

  1. Fill the following details within the Add Environment modal window.
FieldDescription
Environment NameEnter a name for your environment.
Enter NamespaceEnter a namespace corresponding to your environment.
Note: If this namespace does not exist in your cluster, Devtron will create it. If it already exists, Devtron will map the environment to it.
Environment TypeSelect your environment type:
  • Production
  • Non-production
Note: Devtron shows deployment metrics (DORA metrics) for environments tagged as Production only.

Figure 2: Saving an Environment

  1. Assign a Category to environment - Devtron allows you to assign a category (for e.g. Prod, QA, Dev, or Stage) to your environments. This enables category-based filtering in the UI, allowing you to determine whether an application is deployed to Prod, QA, Dev, or Stage environment.

    To assign a category to your environment, follow the steps below:

    1. Select a category from the dropdown under Assign Category and click Update.

    Figure 3: Assigning Category

    1. The selected category will be assigned to the environment.

    Figure 4: Category Assigned

Note: Before assigning a category, you must first add the category. To add a category, refer to Adding a Category section to learn more.

  1. Add/Edit labels to namespace - You can attach labels to your specified namespace in the Kubernetes cluster. Using labels will help you filter and identify resources via CLI or other Kubernetes tools. Click here to know more about labels.

Figure 5: Adding Labels to Namespace

  1. Click Save. Your new environment will be visible in your cluster as shown below.

Figure 6: Newly Created Environment in the Cluster


Edit Environment

Who Can Perform This Action?

Users need to have super-admin permission to edit an environment in a cluster.

You can also make edits to an existing environment if needed.

  1. Navigate to Environments tab.

  2. Hover over the environment you wish to edit, and click the edit icon.

Figure 7: Editing Environment in the Cluster

  1. Edit the environment fields.
FeatureEditable?
Production/Non-Production Option✅ Yes
Description✅ Yes
Labels for Namespace✅ Yes
Assign a category✅ Yes
Environment Name❌ No
Namespace Name❌ No
  1. Click Update to save your changes.

Figure 8: Updating Environment in the Cluster


Delete Environment

Who Can Perform This Action?

Users need to have super-admin permission to delete an environment from a cluster.

If an environment is no longer needed, you can delete it by following these steps:

  1. Navigate to Environments tab.

  2. Hover over the environment you wish to remove, and click the delete icon.

Figure 9: Deleting Environment

Important

Environment deletion is not allowed if any application has a CD pipeline corresponding to the environment. In such a case, go to Workflow Editor and delete the deployment pipeline first, and then return to delete the environment. This action is irreversible, so make sure no critical applications or resources depend on the environment before deleting.

  1. A confirmation dialog will appear. Click Delete to permanently delete the environment.

Figure 10: Confirming Environment Deletion