Page cover

secret

The create secret command creates a new Secret in the Kubernetes cluster to store sensitive data. This command allows specifying key–value pairs, secret type, and associated namespace. Values must be base64-encoded before being stored in the Secret.

Usage

cldkctl create secret [flags]

Steps

Follow the steps below to run and view the result of this command:

  1. You can create a Secret either by opening the built-in editor or by using a YAML configuration file.

  2. To open the editor, run:

cldkctl create secret
  1. The Secret manifest will open in your default text editor (default: vim). Edit the configuration as needed, then save and close the file to apply the changes.

  1. Alternatively, if you prefer to create the Secret by preparing a YAML file beforehand, first identify the sensitive data (for example, username and password) that you want to store in the Secret.

  2. Encode each value using base64.

  1. Prepare a YAML file that defines the Secret configuration, and include the base64-encoded values inside it.

  2. Save this file in the same directory where you will run the cldkctl command.

  3. Use the --file flag to point to the YAML file.

  4. (Optional) To specify a namespace or project, add the --default-namespace or --project flag.

  5. Run the following command in your terminal:

  1. Replace [secret file name] with the path to your YAML configuration file.

  2. Once completed successfully, a message “✓ Secret created” will appear in your terminal.

Flags

This command supports global flags. Refer to the Global Flags section for details.

Flag
Description

-h, --help

Help for create secret command.

Last updated