May 2018
Intermediate to advanced
554 pages
13h 51m
English
A Secret can be also mounted as volume by using the Secret type of the volume. The following is an example of how to use it:
// example of using Secret volume# cat 2-7-3_volumes.yamlapiVersion: v1kind: Podmetadata: name: secret-example-volumespec: containers: - name: ubuntu image: ubuntu command: ["/bin/sh", "-c", "while : ;do cat /secret/token; sleep 10; done"] volumeMounts: - name: secret-volume mountPath: /secret readOnly: true volumes: - name: secret-volume secret: secretName: access-token items: - key: 2-7-1_access-token path: token// create the Podkubectl create -f 2-7-3_volumes.yamlpod "secret-example-volume" created
The preceding example will mount secret-volume into the /secret mount point inside the Pod. /secret will ...