With Kubernetes, you can use Secrets to store sensitive data that can be consumed by pods. Secrets are similar to ConfigMaps, but are encrypted, and meant for storing objects such as passwords, tokens or keys. For non-sensitive data, such as command-line arguments, consider using a ConfigMap. 

Create a Secret

  1. Click the Create button, and select Configuration:

2. Select the cluster where you would like to create the Secret, and click the Continue button:

3. Enter the Secret YAML, or drag & drop an existing Secret file into the following screen. The secret values must already be base64 encoded. For example, in order to encode the string 'testpw', you can run the following command in a terminal echo -n testpw |base64 , which outputs the string dGVzdHB3 :

4. When you are finished creating the Secret, click the Deploy Button. In the example below, we defined a Secret named postgres-credentials , in the default namespace, with three encrypted key/value pairs: POSTGRES_DB , POSTGRES_PASSWORD , and POSTGRES_USER . After the Secret is deployed, any pod in the default namespace should be able to access the these key/value pairs as environment variables.

5. You should now see the newly created Secret, in the Cluster's Configuration page:

6. Selecting View Details  allows you to view, edit, and delete the Secret's YAML configuration:

Did this answer your question?