Secrets in Workloads¶
Kubernetes Secrets¶
Sometimes you want to use sensitive information within your code. For example passwords, OAuth tokens, or ssh keys. The best practice for saving such information in Kubernetes is via Kubernetes Secrets. Kubernetes Secrets let you store and manage sensitive information. Access to secrets is limited via configuration.
A Kubernetes secret may hold multiple key - value pairs.
Using Secrets in Run:ai Workloads¶
Our goal is to provide Run:ai Workloads with secrets as input in a secure way. Using the Run:ai command line, you will be able to pass a reference to a secret that already exists in Kubernetes.
Creating a secret¶
For details on how to create a Kubernetes secret see: https://kubernetes.io/docs/concepts/configuration/secret/. Here is an example:
apiVersion: v1
kind: Secret
metadata:
name: my-secret
namespace: runai-<project-name>
data:
username: am9obgo=
password: bXktcGFzc3dvcmQK
Then run:
Notes
- Secrets are base64 encoded
- Secrets are stored in the scope of a namespace and will not be accessible from other namespaces. Hence the reference to the Run:ai Project name above. Run:ai provides the ability to propagate secrets throughout all Run:ai Projects. See below.
Attaching a secret to a Workload on Submit¶
When you submit a new Workload, you will want to connect the secret to the new Workload. To do that, run:
For example:
Secrets and Projects¶
As per the note above, secrets are namespace-specific. If your secret relates to all Run:ai Projects, do the following to propagate the secret to all Projects:
- Create a secret within the
runai
namespace. - Run the following once to allow Run:ai to propagate the secret to all Run:ai Projects:
Reminder
The Run:ai Administrator CLI can be obtained here.
To delete a secret from all Run:ai Projects, run:
Secrets and Policies¶
A Secret can be set at the policy level. For additional information see policies guide