Skip to content

Commit 8f2975e

Browse files
authored
secrets: now in console (#607)
secrets: replace with Console This marks Console as the preferred way to manage user-defined workload secrets on NAIS.
1 parent 6473f55 commit 8f2975e

File tree

8 files changed

+112
-300
lines changed

8 files changed

+112
-300
lines changed

docs/explanation/secrets.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Secrets
2+
3+
A secret is a piece of sensitive information that is used in a [workload](workloads/README.md).
4+
This can be a password, an API key, or any other information that should not be exposed to the public.
5+
6+
Secrets are kept separate from the codebase and configuration files that are usually stored in version control.
7+
8+
There are two types of secrets on the NAIS platform:
9+
10+
- **Platform-provided secrets** are provisioned and managed by the platform.
11+
12+
These typically contain credentials used for integrating with services that NAIS supports, such as databases, Kafka and so on.
13+
14+
You will generally not deal with these secrets as their values are automatically made available to your workloads at runtime.
15+
16+
- **User-defined secrets** are managed by you and your [team](team.md).
17+
18+
These are typically used for integrating with third-party services or APIs that are not provided by NAIS, such as Slack or GitHub.
19+
20+
User-defined secrets can also be used to store sensitive information specific to your application, such as encryption keys or other private configuration.
21+
22+
## What's next?
23+
24+
- Create a secret and use it in your workload in the [how-to guide](../how-to-guides/secrets.md)
25+
- Find more technical information on the [reference page](../reference/secrets.md)

docs/how-to-guides/secrets.md

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Secrets
2+
3+
This how-to guide shows you how to create a [secret](../explanation/secrets.md) and use it in your [workload](../explanation/workloads/README.md).
4+
5+
## 0. Prerequisites
6+
7+
- You're part of a [NAIS team](./team.md)
8+
- A Github repository where the NAIS team has access
9+
- The repository contains a valid workload manifest (`nais.yaml`)
10+
11+
## 1. Create a secret
12+
13+
1. Open [NAIS console](https://console.<<tenant()>>.cloud.nais.io) in your browser and select your team
14+
2. Select the `Secrets` tab
15+
3. Click `Create Secret` for the environment you want to create the secret in
16+
4. Choose a **name** for your secret and click `Create`
17+
5. Add a key-value pair to your newly created secret
18+
19+
## 2. Use the secret in your workload
20+
21+
1. Add a reference to the secret in the workload's `nais.yaml` manifest.
22+
23+
For a secret named `cool-cat`, the manifest should contain these additional lines:
24+
25+
```yaml title="nais.yaml" hl_lines="2-3"
26+
spec:
27+
envFrom:
28+
- secret: cool-cat
29+
```
30+
31+
The `Copy manifest` button in NAIS Console generates a snippet equivalent to the above.
32+
33+
2. Commit and push the changes to version control, and deploy your workload as usual.
34+
35+
All key-value pairs in the secret are now available in your workload's runtime as environment variables.
36+
37+
## 3. Update the secret
38+
39+
Add, edit, or delete key-value pairs in the secret in Console as desired.
40+
41+
Any changes to the secret will automatically be picked up by your workload, as long as the manifest still references the secret.
42+
43+
## Further reading
44+
45+
See the [reference](../reference/secrets.md#workloads) for additional ways of using secrets in your workload.

docs/reference/secrets.md

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Secrets
2+
3+
This is the reference documentation for [secrets](../explanation/secrets.md) on the NAIS platform.
4+
5+
## Console
6+
7+
Find and manage your team's user-defined secrets in the [NAIS Console](https://console.<<tenant()>>.cloud.nais.io).
8+
9+
## Workloads
10+
11+
Use a secret in your [workload](../explanation/workloads/README.md) by referencing them in your `nais.yaml` manifest.
12+
The secret can be made available as environment variables, files, or both.
13+
14+
### Environment Variables
15+
16+
```yaml
17+
spec:
18+
envFrom:
19+
- secret: <secret-name>
20+
```
21+
22+
See the workload references for more information:
23+
24+
- [Application](../reference/application-spec.md#envfromsecret)
25+
- [NaisJob](../reference/naisjob-spec.md#envfromsecret)
26+
27+
### Files
28+
29+
```yaml
30+
spec:
31+
filesFrom:
32+
- secret: <secret-name>
33+
mountPath: /var/run/secrets/<secret-name>
34+
```
35+
36+
See the workload references for more information:
37+
38+
- [Application](../reference/application-spec.md#filesfromsecret)
39+
- [NaisJob](../reference/naisjob-spec.md#filesfromsecret)

docs/security/README.md

+3-10
Original file line numberDiff line numberDiff line change
@@ -112,17 +112,10 @@ provided by NAIS:
112112

113113
#### Secrets
114114

115-
NAIS provides a secure way to store secrets in the form of [Kubernetes
116-
secrets][kubernetes-secrets]. These secrets are encrypted at rest and are only
117-
accessible by the application that they are associated with.
115+
NAIS provides a secure way to store [secrets] for use by applications.
116+
These secrets are encrypted at rest and are only accessible by applications and members of a given team.
118117

119-
In addition to Kubernetes secrets NAIS provides integration with [Google Secrets
120-
Manager][google-secrets-manager] and [Hashicorp Vault][hashicorp-vault] for
121-
enhanced secret management.
122-
123-
[kubernetes-secrets]: ./secrets/kubernetes-secrets.md
124-
[google-secrets-manager]: ./secrets/google-secrets-manager.md
125-
[hashicorp-vault]: ./secrets/vault.md
118+
[secrets]: ../explanation/secrets.md
126119

127120
#### External dependencies
128121

docs/security/secrets/README.md

-13
This file was deleted.

docs/security/secrets/google-secrets-manager.md

-223
This file was deleted.

0 commit comments

Comments
 (0)