January 2019
Intermediate to advanced
484 pages
11h 48m
English
Let's see how to read secrets from files inside a pod first:
// example for how a Pod retrieve secret# cat 3-2-3_pod_vol_secret.yamlapiVersion: v1kind: Podmetadata: name: secret-accessspec: containers: - name: centos image: centos command: ["/bin/sh", "-c", "while : ;do cat /secret/password-example; sleep 10; done"] volumeMounts: - name: secret-vol mountPath: /secret readOnly: true volumes: - name: secret-vol secret: secretName: mypassword items: - key: mypassword path: password-example// create the pod # kubectl create -f 3-2-3_pod_vol_secret.yaml pod "secret-access" created
The secret file will be mounted in /<mount_point>/<secret_name> without specifying itemskey, path, or /<mount_point>/<path> in the pod. ...
Read now
Unlock full access