Mounting ConfigMaps and Secrets as files
Mounting application configuration maps and secrets as files
In Kubernetes, you can mount application configurations or secrets as files.
- 1.In the DuploCloud Portal, navigate to the DevOps -> Containers -> AKS / Native page
- 2.Click the K8S Config Maps tab.
- 3.Click Add. The Add Kubernetes Config Map pane displays.
- 4.Name the ConfigMap you want to create, such as my-config-map.
- 5.Add a Data 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. - 6.Click Create.

Add Kubernetes Config Map pane
- 1.In the DuploCloud Portal, navigate to the DevOps -> Containers -> AKG/ Native page.
- 2.Click the Services tab.
- 3.Select the service you want to modify from the Name column.
- 4.Click the Actions menu and select Edit.

Actions menu on the Services page
- 1.On the Edit Service: service_name Basic Options page, click Next to navigate to the Advanced Options page.
- 2.On the Advanced Options page, in the Volumes field, 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:- Name: my-config
Path: /app/my-config
Spec:
ConfigMap:
Name: my-config-map

Mouting ConfigMap as a volume in the Advanced Options page
If you want to select individual ConfigMap items, specifying 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: Path: /app/my-config
Spec:
ConfigMap:
Name: my-config-map
Items:
- Key: my-file-name
Path: config-file
- 1.In the DuploCloud Portal, navigate to the DevOps -> Containers -> AKG/ Native page.
- 2.Click the K8S Secrets tab.
- 3.Click Add. The Add Kubernetes Secret pane displays.
- 4.Enter the Secret Name that you want to create, such as my-secret-files.
- 5.Add Secret Details such as a data key/value pair for each file in your secret. The key is the file name, and the value is the file's contents, separated by a colon (
:
). - 6.Click Add to create the secret.

Add Kubernetes Secret pane
- 1.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. - 2.Click Add to create the multi-line secret.

- 1.
- 2.On the Edit Service: service_name Basic Options page, click Next to navigate to the Advanced Options page.
- 3.On the Advanced Options page, in the Volumes field, 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:- Name: my-config
Path: /app/my-config
Spec:
Secret:
SecretName: my-secret-files

Mouting a Secret as a volume in the Advanced Options page
If you want to select individual Secret items, specifying 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:- Name: my-config
Path: /app/my-config
Spec:
Secret:
SecretName: my-secret-files
Items:
- Key: secret-file
Path: config-file