One of the challenges of building a microservice architecture is protecting the secrets that are necessary for its successful operation. Unlike in monolithic architectures where credentials are provided from one place, each microservice must have its own set of credentials for accessing resources that it needs, such as databases and other services. As your architecture scales, so does the complexity of maintaining secrets for every single service.
A “secret” can be any sensitive credential, key, or password that would compromise your application/business security if exposed. Some examples:
- Database credentials
- Private keys for signing or identity (e.g., SSH keys or API keys)
- Private certificates for communication (e.g., PGP, SSL)
Walhall provides an interface that lets you define secrets for each of the modules in your app. These secrets are delivered to the container running your app at initialization time. This setup ensures that only the owner of a Walhall app can access the secrets.
How to set secrets for modules
If you have already created an app in Walhall with one or more modules, then you can set the secrets for each module.
- Log in to Walhall.
- Switch to the app where you want to set the secrets.
- Click on the module whose secrets you want to set.
- The Details tab will load. Click the Secrets button above the module details.
- The Secrets tab will load. Enter the key name for your secret in the left input field, and enter its value in the right input field.
- Click Create new secret.
- Click Close in the top right corner and then re-deploy your app.
Now the module can access the secret as an environment variable in the Pod where it runs.
Once you create a secret, it will display as hidden by default whenever you load the Secrets tab again.
Note that you must define secrets for each environment separately—secrets are not promoted when you create a new environment.
We recommend the following best practices for managing your secrets:
- Never commit secrets to a source code repository. Anyone with access to the repository will have access to the secrets.
- Do not store secrets in the module’s configuration (under the “Configuration” tab).
- Ensure that your secrets are difficult to guess or crack.
- Do not reuse secrets among modules.