k3s/examples/secrets
Jeff Lowdermilk 553f9f822b Add ga-beacon analytics to gendocs scripts
hack/run-gendocs.sh puts ga-beacon analytics link into all md files,
hack/verify-gendocs.sh verifies presence of link.
2015-05-15 18:56:38 -07:00
..
README.md Add ga-beacon analytics to gendocs scripts 2015-05-15 18:56:38 -07:00
secret-pod.yaml Add example for secrets 2015-04-30 12:35:21 -04:00
secret.yaml Add example for secrets 2015-04-30 12:35:21 -04:00

README.md

Secrets example

Following this example, you will create a secret and a pod that consumes that secret in a volume.

Step Zero: Prerequisites

This example assumes you have a Kubernetes cluster installed and running, and that you have installed the kubectl command line tool somewhere in your path. Please see the getting started for installation instructions for your platform.

Step One: Create the secret

A secret contains a set of named byte arrays.

Use the examples/secrets/secret.yaml file to create a secret:

$ kubectl create -f examples/secrets/secret.yaml

You can use kubectl to see information about the secret:

$ kubectl get secrets
NAME          TYPE      DATA
test-secret   Opaque    2

Step Two: Create a pod that consumes a secret

Pods consume secrets in volumes. Now that you have created a secret, you can create a pod that consumes it.

Use the examples/secrets/secret-pod.yaml file to create a Pod that consumes the secret.

$ kubectl create -f examples/secrets/secret-pod.yaml

This pod runs a binary that displays the content of one of the pieces of secret data in the secret volume:

$ kubectl log secret-test-pod
2015-04-29T21:17:24.712206409Z content of file "/etc/secret-volume/data-1": value-1

Analytics