From d58ba7b075bb4848349a2c920caaa08ff3773d70 Mon Sep 17 00:00:00 2001 From: Dmitry Shulyak Date: Wed, 20 Jul 2016 17:05:19 +0300 Subject: [PATCH] Add example mounting ConfigMap as a single file into /etc dir ref: https://github.com/kubernetes/kubernetes/pull/22575 --- docs/user-guide/configmap/README.md | 3 +++ docs/user-guide/configmap/mount-file-pod.yaml | 21 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 docs/user-guide/configmap/mount-file-pod.yaml diff --git a/docs/user-guide/configmap/README.md b/docs/user-guide/configmap/README.md index e6bf6f52a5..2df57176dd 100644 --- a/docs/user-guide/configmap/README.md +++ b/docs/user-guide/configmap/README.md @@ -101,3 +101,6 @@ This pod runs a `cat` command to print the value of one of the keys in the volum $ kubectl logs config-volume-test-pod value-1 ``` + +Alternatively you can use [`mount-file-pod.yaml`](mount-file-pod.yaml) file to mount +only a file from ConfigMap, preserving original content of /etc directory. diff --git a/docs/user-guide/configmap/mount-file-pod.yaml b/docs/user-guide/configmap/mount-file-pod.yaml new file mode 100644 index 0000000000..7efd9b4003 --- /dev/null +++ b/docs/user-guide/configmap/mount-file-pod.yaml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: Pod +metadata: + name: config-single-file-volume-pod +spec: + containers: + - name: test-container + image: gcr.io/google_containers/busybox + command: [ "/bin/sh", "-c", "cat /etc/special-key" ] + volumeMounts: + - name: config-volume + mountPath: /etc/special-key + subPath: path/to/special-key + volumes: + - name: config-volume + configMap: + name: test-configmap + items: + - key: data-1 + path: path/to/special-key + restartPolicy: Never