For the complete documentation index, see llms.txt. This page is also available as Markdown.

Setting Kubernetes Secrets

Set and manage Kubernetes Secrets in the DuploCloud Portal, including troubleshooting format issues.

Kubernetes Secrets securely store sensitive data such as passwords, tokens, and keys outside application code.

To securely manage Kubernetes secrets, follow these best practices:

  • Utilize Centralized Secret Management Tools to streamline storage, versioning, and access control.

  • Implement Access Controls to ensure only authorized users and workloads can access or modify secrets.

  • Regularly Rotate Secrets to limit exposure if a secret is compromised.

  • Audit Access Logs to monitor for unauthorized access or anomalies.

Using these strategies with DuploCloud's Kubernetes Secrets interface helps keep secret management secure and maintainable across your environments.

Creating a Kubernetes Secret

  1. In the DuploCloud Portal, navigate to Kubernetes -> Secrets.

  2. Click Add. The Add Kubernetes Secret pane displays.

    Add Kubernetes Secret pane
  3. Complete these fields:

Secret Name

A unique name for the secret.

Secret Type

Enter the Kubernetes secret type (e.g., Opaque, kubernetes.io/dockerconfigjson, etc.). Choose Opaque for generic key/value pairs.

Secret Details

Enter the key/value pairs that make up the secret. Use the format key: value per line, where the key is the filename and the value is its contents.

Skip Encoding Secret (if already encoded)

Select this option if your secret value is already base64-encoded. DuploCloud will store it as provided without performing additional encoding.

  1. Optionally, select Advanced Options and configure the following fields as needed:

Secret Labels

Enter one or more key-value pairs to categorize the secret. For example, you can assign an app name using app.duplocloud.net/app-name: "<app name>" to enable filtering K8s resources by app in the DuploCloud Portal.

Secret Annotations

Enter one or more key-value pairs to add custom metadata to the secret. Use annotations to attach descriptive or operational information that can be referenced by Kubernetes or other tools.

  1. Click Add to create the secret.

To use this Secret in your application, mount it as a volume in a container.

Creating a multi-line Kubernetes Secret

  1. Follow the steps in creating a Kubernetes Secret. In the Secret Details field, define a key such as PRIVATE_KEY_FILENAME, as shown below.

  2. Click Add to create the multi-line secret.

To use this Secret in your application, mount it as a volume in a container.

The Kubernetes Secrets page in the DuploCloud Portal

Editing a Kubernetes Secret

  1. In the DuploCloud Portal, navigate to KubernetesSecrets.

  2. Locate the Secret you want to edit and click the menu icon ().

  3. Select Edit.

  4. Update the Secret values as needed.

  1. To review your changes before saving, click View Diff. The View Differences pane displays the original and updated Secret side by side so you can easily review the changes.

  1. Click Close to close the View Differences pane.

  2. To apply the changes, click Update.

Troubleshooting Secret Format Issues

When entering a Kubernetes Secret that includes a private key in DuploCloud, format the data as key/value pairs and ensure all keys and values are strings. If you encounter format errors, the cause is usually a non-string value or incorrect multiline formatting. Use the | character to indicate multiline strings, and split a single-line private key into multiple lines if needed. Comparing your input with an existing working Secret can also help resolve formatting issues.

Last updated

Was this helpful?