This repository has been archived by the owner on Aug 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
02 Use Secrets
satrapu edited this page Oct 14, 2017
·
4 revisions
This page details how to provide secrets to a container.
Passing sensitive data (e.g. credentials, certificates, etc.) to containers should be done in a secured manner and Rancher offers support for this kind of activity.
More information can be found here.
- Go to Rancher UI
- Go to menu → Stacks → User
- Click "Add from catalog"
- Filter catalog items by "rancher secrets"
- Click the "View Details" button
- Leave all fields set to default values and click "Launch" button
- Go to menu → Infrastructure → Secrets
- Click "Add Secret" button
- Fill in the fields accordingly
- Click "Save" button and you should see the newly added secret
- Go to menu → Infrastructure → Containers
- Click the top left "Add Container" button
- Fill in the fields in order to start a container based on the alpine Docker image
- Name: alpine
- Description: My first adhoc container running on Rancher!
- Image: alpine
- Command tab → Command: tail -f /dev/null
- This will force the container to remain in running state after start-up so that one may execute shell commands, view container logs or interact with it in other any way
- Secrets tab → Add Secret: choose tgd5 and optionally can set an alias, via As Name field
If the "As Name" field was not set, the secret will be available at path: /run/secrets/tgd5.
If the "As Name" field was set to "my_secret", the secret value will be available at path: /run/secrets/my_secret.
- Click the "Create" button
- Once the container is running, go to container top right menu and select "Execute Shell"
- Inside the console, type "cat /run/secrets/my_secret" to print the secret value