Mounting ConfigMaps and Secrets as files
Mounting application configuration maps and secrets as files
Last updated
Mounting application configuration maps and secrets as files
Last updated
© DuploCloud, Inc. All rights reserved. DuploCloud trademarks used herein are registered trademarks of DuploCloud and affiliates
In Kubernetes, you can mount application configurations or secrets as files.
Before you create and mount the Kubernetes ConfigMap, you must create a DuploCloud Service.
In the DuploCloud Portal, navigate to Kubernetes -> Config Maps.
Click Add. The Add Kubernetes Config Map pane displays.
Give the ConfigMap a name, such as my-config-map.
In the Data field, add a key/value pair for each file in your config map, separated by a colon (:
). The key is the file name, and the value is the file's contents.
Click Create.
In the DuploCloud Portal, navigate to Kubernetes -> Services.
Select the Service you want to modify from the Name column.
Click the Actions menu and select Edit.
On the Edit Service: service_name Basic Options page, click Next to navigate to the Advanced Options page.
In the Volumes field on the Advanced Options page, enter the configuration YAML to mount the ConfigMap as a volume.
For example, to mount a config map named my-config-map
to a directory named /app/my-config
enter the following YAML code block in the Volumes field:
If you want to select individual ConfigMap items and specify the subpath for mounting, you can use a different configuration. For example, if you want the key named my-file-name
to be mounted to /app/my-config/config-file
use the following YAML:
Before you create and mount a Kubernetes Secret, you must create a DuploCloud Service.
In the DuploCloud Portal, navigate to Kubernetes -> Secrets.
Click Add. The Add Kubernetes Secret pane displays.
Give the secret a name, such as my-secret-files.
Add Secret Details such as a key/value pair for each file in your secret separated by a colon (:
). The key is the file name, and the value is the file's contents.
Click Add to create the secret.
Follow the steps in creating a Kubernetes Secret, defining a Key value using the PRIVATE_KEY_FILENAME
in the Secret Details field, as shown below.
Click Add to create the multi-line secret.
In the DuploCloud Portal, edit the DuploCloud Service.
On the Edit Service: service_name Basic Options page, click Next to navigate to the Advanced Options page.
In the Volumes field on the Advanced Options page, enter the configuration YAML to mount the Secret as a volume.
For example, to mount a Secret named my-secret-files
to a directory named /app/my-config
Enter the following YAML code block in the Volumes field:
If you want to select individual Secret items and specify the subpath for mounting, you can use a different configuration. For example, if you want the key named secret-file
to be mounted to /app/my-config/config-file
use the following YAML: