All Products
Search
Document Center

Enterprise Distributed Application Service:Configure environment variables

Last Updated:Mar 11, 2026

Environment variables separate configuration from application code, letting you customize runtime behavior across environments without redeploying. They also keep sensitive data -- such as database credentials and API keys -- out of your source code.

Background information

EDAS supports three types of environment variables for applications deployed on Kubernetes clusters:

Type

Description

Use case

Custom

Key-value pairs you define directly

Application-specific settings like JAVA_HOME, APP_PORT

ConfigMap

References to Kubernetes ConfigMap entries

Shared, non-sensitive configuration across multiple applications

Secret

References to Kubernetes Secret entries

Passwords, certificates, API keys

ConfigMaps and Secrets must be in the same region, cluster, and Kubernetes namespace as the application that references them.

Note

To create a ConfigMap, see Create a configuration item. To create a Secret, see Create a Secret.

Prerequisites

Before you begin, make sure that you have:

  • An EDAS account with access to the EDAS console

  • A Kubernetes cluster created in EDAS

  • (Optional) A ConfigMap or Secret in the same region, cluster, and Kubernetes namespace as your application

Add environment variables

You can configure environment variables when you create an application or when you deploy an existing application. In both cases, the variables are passed to the container at startup.

Important

Saving environment variable changes restarts the application. Configure environment variables during off-peak hours to minimize impact.

Add variables during application creation

  1. Log on to the EDAS console.

  2. In the left-side navigation pane, choose Application Management > Applications.

  3. In the top navigation bar, select a region. In the upper part of the page, select a namespace.

  4. In the upper-left corner, click Create Application.

  5. In the Basic Information step, set Cluster Type to Kubernetes Clusters and select your Application Runtime Environment (see Application runtime options), then click Next.

  6. In the Configurations step, configure the environment information, basic information, deployment method, and resource parameters, then click Next.

  7. In the Advanced Settings step, click Environment Variables and add variables using any of the methods described in Variable configuration methods.

  8. Click Create Application.

  9. On the Creation Completed page, review the settings in Basic Information, Configurations, and Advanced Settings, then click Create Application.

  10. On the Application Overview page, click View Details. On the Change List page, monitor the deployment progress. After the change completes, verify that the pod status in the Basic Information section shows the pod is running.

Add variables during application deployment

If you did not configure environment variables during application creation, add them when you deploy or redeploy the application.

  1. Log on to the EDAS console.

  2. In the left-side navigation pane, choose Application Management > Applications.

  3. In the top navigation bar, select a region. In the upper part of the page, select a namespace.

  4. From the Cluster Type drop-down list, select Container Service or Serverless Kubernetes Cluster.

  5. Find the target application and click its name.

  6. On the Overview or Basic information page, choose Deploy > Deploy in the upper-right corner.

  7. On the Select Deployment Mode page, select a deployment mode and click Start Deployment.

  8. Set the runtime environment and deployment package, then click Environment Variables to add variables using any of the methods described in Variable configuration methods.

  9. Click OK.

Variable configuration methods

You can add variables individually or in bulk.

Add a single variable

Choose one of the following methods based on your variable type:

Custom variable

Enter a variable name and value directly.

Custom - Environment variable 1

Note

To configure JVM heap memory, JVM properties, or Java agent parameters, set the following:

  • Variable Name: CATALINA_OPTS

  • Variable Value: [Parameter to be added] $(EDAS_CATALINA_OPTS)

Common environment variables for MySQL images:

Variable

Required

Description

MYSQL_ROOT_PASSWORD

Yes

Sets the MySQL root password

MYSQL_USER and MYSQL_PASSWORD

No

Creates an additional user account with a password

MYSQL_DATABASE

No

Specifies a database to create at container startup

For other image types, configure environment variables based on the image documentation.

ConfigMap reference

Select a ConfigMap from the Variable Value/Variable Reference drop-down list, then select a key-value pair from the ConfigMap.

Secret reference

Select a Secret from the Variable Value/Variable Reference drop-down list, then select a key-value pair from the Secret.

Add multiple variables in bulk

To inject environment variables in bulk from a ConfigMap or Secret, configure the following parameters:

Parameter

Description

Type

Select Configuration Items (ConfigMap) or Secret. Custom variables are not supported in bulk mode.

Configuration Mode

env: Select specific key-value pairs from the ConfigMap or Secret. envFrom: Inject all key-value pairs from the ConfigMap or Secret.

Configuration Items

Select a ConfigMap from the drop-down list.

Reference Environment Variable

Select key-value pairs to inject (available in env mode only).

Note

You can add a maximum of 100 environment variables at a time. After adding variables, set the variable names based on your requirements.

Verify the result

Confirm that environment variables are active using either method:

  • Change records: In the left-side navigation pane of the application details page, click Change Records. If the Change Status column shows Success, the configuration is in effect.

  • Pod status: On the Application Overview page, click Running Pods (Click View) next to Running Status. In the Pod section, check the Status column. A green dot indicates the application is running with the updated configuration.

Application runtime options

Select the runtime environment that matches your application type:

Runtime

Description

Java > Custom

Deploy using a custom image in a Kubernetes cluster

Java > Java

Deploy a Dubbo or Spring Boot application using a JAR package. Configurable: Java Environment.

Java > Tomcat

Deploy a Dubbo or Spring application using a WAR package. Configurable: Java Environment, Container Version.

Java > EDAS-Container (HSF)

Deploy an HSF application using a WAR or FatJar package. Configurable: Java Environment, Pandora Version, Ali-Tomcat Version.

PHP

Deploy a PHP application that runs on Apache HTTP Server

Node.js, C++, Go, and Other Languages

Deploy using a custom image in a Kubernetes cluster