> For the complete documentation index, see [llms.txt](https://docs.cloudeka.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cloudeka.ai/cloudeka-api-list/command-reference/cldkctl-create/secret.md).

# 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
```

3. 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.

<figure><img src="/files/5ZMeEWHP1tbg7RpnZmFJ" alt=""><figcaption></figcaption></figure>

4. 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.
5. Encode each value using base64.

```
echo -n [username] | base64  
echo -n [password] | base64 
```

6. Prepare a YAML file that defines the Secret configuration, and include the base64-encoded values inside it.
7. Save this file in the same directory where you will run the cldkctl command.
8. Use the --file flag to point to the YAML file.
9. (Optional) To specify a namespace or project, add the --default-namespace or --project flag.
10. Run the following command in your terminal:

```
cldkctl create secret --file [secret file name]
```

11. Replace \[secret file name] with the path to your YAML configuration file.
12. Once completed successfully, a message “✓ Secret created” will appear in your terminal.

<figure><img src="/files/P3E7Mb0anuy1DvFTJL2V" alt=""><figcaption></figcaption></figure>

## Flags

{% hint style="info" %}
This command supports [global flags.](/cloudeka-api-list/global-flags.md) Refer to the Global Flags section for details.
{% endhint %}

| Flag       | Description                     |
| ---------- | ------------------------------- |
| -h, --help | Help for create secret command. |
