Secret Mounting
Overview
In ModelArts inference service scenarios, secret mounting leverages the secret mechanism to achieve encrypted storage and secure injection of sensitive information. This prevents plaintext storage of sensitive data such as account passwords, AK/SK, database credentials, and certificates, thereby ensuring data security and privilege isolation during the runtime of the inference service.
Typical scenarios:
- Model/Storage access authentication
When an inference service needs to access resources like OBS or SFS Turbo, secret mounting injects the required AK/SK, access keys, or signature credentials. This avoids providing them in plaintext within configuration files or environment variables.
- Third-party service integration
When an inference service calls databases, message queues, API gateways, or authentication services, it mounts sensitive information such as database account passwords, API authentication keys, tokens, and private key certificates to secure cross-service communication.
- Custom image execution
When deploying an inference service based on a custom image, the application inside the image may need to read encrypted configurations, private keys, certificates, or license files. Secret mounting securely injects these encrypted files into designated paths within the container, preventing sensitive information from being baked into the image.
- Multi-tenant / multi-environment privilege isolation
When multiple inference services share infrastructure under the same resource pool or cluster, secret mounting achieves service-level isolation of sensitive information. Each instance only retrieves its own required secrets, minimizing the attack surface for credential leaks.
Supported secret mounting methods in ModelArts
- Custom secret: Users manually enter sensitive or private data in key-value pairs, which are then encrypted and stored using the platform's native secret security mechanism. When deploying an inference service, these secrets can be directly mounted into the inference container as files for the service application to read and use. As a platform-native, lightweight secret management approach, it does not rely on external encryption services and stands as the most commonly used local private information configuration method for inference scenarios.
- DEW: Data Encryption Workshop (DEW) is a comprehensive cloud data encryption service, including Key Management Service (KMS), Key Pair Service (KPS), and Dedicated Hardware Security Module (Dedicated HSM). To use DEW to configure the key, go to the DEW console to create a key, select the DEW key on the ModelArts console, and enter the mount path.
Constraints
- Resource pool constraints: Secret mounting is supported for real-time inference services deployed in both dedicated resource pools and public resource pools.
- Mount method constraints: Only two mount methods are supported: Custom secret and DEW secret. Directly mounting plaintext sensitive information is not supported.
- Mount path constraints: The mount path inside the container must be a completely new directory and must not overwrite existing system or service directories. When mounting multiple secrets, paths must not overlap or cause parent-child directory conflicts (for example, /secret/ and /secret/custom/). The path must start with a forward slash (/) and cannot exceed 255 characters in length.
- Permission association constraints: If Associate Image User Group ID is checked, secret mount permissions will be bound to the container image's startup user group; processes outside of this user group will be unable to read the secrets. Additionally, a mounted DEW secret must be unbound from the service before it can be deleted, otherwise it will cause instance anomalies or a failed restart.
Prerequisites
- Permissions: You must have activated permissions for ModelArts and DEW, including permissions for real-time inference service deployment, secret configuration, secret management, and Cloud Shell debugging. For details, see Configuring Agency Authorization for ModelArts with One Click.
- Resource preparation: If you select a dedicated resource pool when deploying the inference service, ensure that the dedicated resource pool (supporting CPU, GPU, or NPU heterogeneous resource pools) has already been created.
- DEW preparation: For DEW mounting, log in to the DEW console and create a key-value pair secret.
Secret Mount Configuration
Log in to the ModelArts console and choose Model Inference > Real-Time Inference. When deploying a real-time service, check Key Settings under Advanced Settings during the deployment configuration phase. For details, see Deploying a Real-Time Inference Service Using a Single Node.
If you select Custom key, fill in the following fields:
- Key: A custom name, such as infer-password.
- Value: The Base64-encoded secret value.
- Mount Path: The path inside the inference container, such as /secret/custom/.
(Optional) If multiple secrets are required, click Add.
(Optional) Check Associate Image User Group ID. Once checked, secret mount permissions will be bound to the container image startup user's group ID; processes outside of this user group will be unable to read the secrets.

If you select DEW, fill in the following fields:
- DEW Secret: Select a secret from the drop-down list. If no options are available, you must navigate to the DEW console to create a secret.
- Mount Path: The path inside the inference container, such as /secret/dew/.
(Optional) If multiple secrets are required, click Add.
(Optional) Check Associate Image User Group ID. Once checked, secret mount permissions will be bound to the container image startup user's group ID; processes outside of this user group will be unable to read the secrets.
Configuration Verification
Go to the real-time inference service details page. On the Cloud Shell tab, select the deployment, deployment replica, and resource instance (pod). Once the connection is successful, check the mounted files.
The commands below are examples only. Replace the mount paths and file names with your actual configurations.
# View the custom secret cat /secret/custom/infer-password # View the DEW secret cat /secret/dew/accessKeyId
If the contents can be read normally, the mount was successful.
Since public resource pools do not support Cloud Shell, the above verification method is only applicable to real-time inference services deployed in dedicated resource pools.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot