Secrets
Secrets and configmaps both are used to store environment variables but there is one major difference between them: Configmap stores key-values in normal text format while secrets store them in base64 encrypted form. Devtron hides the data of secrets for the normal users and it is only visible to the users having edit permission.
Secret objects let you store and manage sensitive information, such as passwords, authentication tokens, and ssh keys. Embedding this information in secrets is safer and more flexible than putting it verbatim in a Pod definition or in a container image.
Configure Secret
![](https://docs.devtron.ai/~gitbook/image?url=https%3A%2F%2Fdevtron-public-asset.s3.us-east-2.amazonaws.com%2Fimages%2Fcreating-application%2Fsecrets%2Fadd-secret.jpg&width=768&dpr=4&quality=100&sign=85c6a8f6&sv=1)
Click on Add Secret
to add a new secret.
![](https://docs.devtron.ai/~gitbook/image?url=https%3A%2F%2Fdevtron-public-asset.s3.us-east-2.amazonaws.com%2Fimages%2Fcreating-application%2Fsecrets%2Fcreating-applications-secrets-2.jpg&width=768&dpr=4&quality=100&sign=27df652c&sv=1)
Key | Description |
---|---|
| Provide a name to your Secret |
| Provide the Data Type of your secret. To know about different Data Types available click on Data Types |
| Specify if there is a need to add a volume that is accessible to the Containers running in a pod. |
| Select this option if you want to inject Environment Variables in your pods using Secrets. |
| Select this option if you want to configure a Data Volume that is accessible to Containers running in a pod. Ensure that you provide a Volume mount path for the same. |
| Provide a key and the corresponding value of the provided key. |
Volume Mount Path
Specify the volume mount folder path in Volume Mount Path
, a path where the data volume needs to be mounted. This volume will be accessible to the containers running in a pod.
![](https://docs.devtron.ai/~gitbook/image?url=https%3A%2F%2Fdevtron-public-asset.s3.us-east-2.amazonaws.com%2Fimages%2Fcreating-application%2Fsecrets%2Fsecret-volume-mount-path.jpg&width=768&dpr=4&quality=100&sign=49986b9d&sv=1)
Sub Path
For multiple files mount at the same location you need to check sub path bool
field, it will use the file name (key) as sub path. Sub Path feature is not applicable in case of external configmap except AWS Secret Manager, AWS System Manager and Hashi Corp Vault, for these cases Name (Secret key)
as sub path will be picked up automatically.
File Permission
File permission will be provide at the configmap level not on the each key of the configmap. it will take 3 digit standard permission for the file.
Click on Save Secret
to save the secret.
![](https://docs.devtron.ai/~gitbook/image?url=https%3A%2F%2Fdevtron-public-asset.s3.us-east-2.amazonaws.com%2Fimages%2Fcreating-application%2Fsecrets%2Fcreating-applications-secrets-4.jpg&width=768&dpr=4&quality=100&sign=a9873a66&sv=1)
You can see the Secret is added.
![](https://docs.devtron.ai/~gitbook/image?url=https%3A%2F%2Fdevtron-public-asset.s3.us-east-2.amazonaws.com%2Fimages%2Fcreating-application%2Fsecrets%2Fcreating-applications-secrets-5.gif&width=768&dpr=4&quality=100&sign=db57e4e0&sv=1)
Update Secrets
You can update your secrets anytime later, but you cannot change the name of your secrets. If you want to change your name of secrets then you have to create a new secret.
To update secrets, click on the secret you wish to update.
![](https://docs.devtron.ai/~gitbook/image?url=https%3A%2F%2Fdevtron-public-asset.s3.us-east-2.amazonaws.com%2Fimages%2Fcreating-application%2Fsecrets%2Fcreating-applications-secrets-6.jpg&width=768&dpr=4&quality=100&sign=d327f9a8&sv=1)
Click on Update Secret
to update your secret.
Delete Secret
You can delete your secret. Click on your secret and click on the delete sign
to delete your secret.
![](https://docs.devtron.ai/~gitbook/image?url=https%3A%2F%2Fdevtron-public-asset.s3.us-east-2.amazonaws.com%2Fimages%2Fcreating-application%2Fsecrets%2Fcreating-applications-secrets-7.jpg&width=768&dpr=4&quality=100&sign=8dc38145&sv=1)
Data Types
There are five Data types that you can use to save your secret.
Kubernetes Secret: The secret that you create using Devtron.
Kubernetes External Secret: The secret data of your application is fetched by Devtron externally. Then the Kubernetes External Secret is converted to Kubernetes Secret.
AWS Secret Manager: The secret data of your application is fetched from AWS Secret Manager and then converted to Kubernetes Secret from AWS Secret.
AWS System Manager: The secret data for your application is fetched from AWS System Secret Manager and all the secrets stored in AWS System Manager are converted to Kubernetes Secret.
Hashi Corp Vault: The secret data for your application is fetched from Hashi Corp Vault and the secrets stored in Hashi Corp Vault are converted to Kubernetes Secret.
Note: The conversion of secrets from various data types to Kubernetes Secrets is done within Devtron and irrespective of the data type, after conversion, the Pods access secrets
normally.
External Secrets
In some cases, it may be that you already have secrets for your application on some other sources and you want to use that on devtron. External secrets are fetched by devtron externally and then converted to kubernetes secrets.
Kubernetes External Secret
The secret that is already created and stored in the environment and being used by devtron externally is referred here as Kubernetes External Secret
. For this option, devtron will not create any secret by itself but they can be used within the pods. Before adding secret from kubernetes external secret, please make sure that secret with the same name is present in the environment. To add secret from kubernetes external secret, follow the steps mentioned below:
Navigate to
Secrets
of the application.Click on
Add Secret
to add a new secret.Select
Kubernetes External Secret
from dropdown ofData type
.Provide a name to your secret. Devtron will search secret in the environment with the same name that you mention here.
AWS Secret Manager
Before adding any external secrets on devtron, kubernetes-external-secrets
must be installed on the target cluster. Kubernetes External Secrets allows you to use external secret management systems (e.g., AWS Secrets Manager, Hashicorp Vault, etc) to securely add secrets in Kubernetes.
Installing kubernetes-external-secrets Using Chart
To install the chart with the release named my-release:
To install the chart with AWS IAM Roles for Service Accounts:
Adding Secrets From AWS Secret Manager
To add secrets from AWS secret manager, navigate to Secrets
of the application and follow the steps mentioned below :
Click on
Add Secret
to add a new secret.
![](https://docs.devtron.ai/~gitbook/image?url=https%3A%2F%2Fdevtron-public-asset.s3.us-east-2.amazonaws.com%2Fimages%2Fcreating-application%2Fsecrets%2Faws-secret-manager.jpg&width=768&dpr=4&quality=100&sign=7a621896&sv=1)
Select
AWS Secret Manager
from dropdown ofData type
.Provide a name to your secret.
Select how you want to use the secret. You may leave it selected as environment variable and also you may leave
Role ARN
empty.In
Data
section, you will have to provide data in key-value format.
All the required field to pass your data to fetch secrets on devtron are described below :
Key | Description |
---|---|
| Secret key in backend |
| Name for this key in the generated secret |
| Property to extract if secret in backend is a JSON object |
| Set this to true if configuring an item for a binary file stored else set false |
Adding Secrets in AWS Secret Manager
To add secrets in AWS secret manager, do the following steps :
Go to AWS secret manager console.
Click on
Store a new secret
.Add and save your secret.
![](https://docs.devtron.ai/~gitbook/image?url=https%3A%2F%2Fdevtron-public-asset.s3.us-east-2.amazonaws.com%2Fimages%2Fcreating-application%2Fsecrets%2Fcreating-applications-secrets-10.jpg&width=768&dpr=4&quality=100&sign=3b58c353&sv=1)
Last updated