From 607db2936797d87333a08ed08b6b1dff7c1a2e49 Mon Sep 17 00:00:00 2001 From: Qiming Teng Date: Mon, 25 Dec 2017 15:24:55 +0800 Subject: [PATCH] Add configMap as volume type Closes: #2385 --- docs/concepts/storage/volumes.md | 40 ++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/docs/concepts/storage/volumes.md b/docs/concepts/storage/volumes.md index 2c5ccf492d..4cdea0e642 100644 --- a/docs/concepts/storage/volumes.md +++ b/docs/concepts/storage/volumes.md @@ -69,6 +69,7 @@ Kubernetes supports several types of Volumes: * `azureDisk` * `azureFile` * `cephfs` + * `configMap` * `csi` * `downwardAPI` * `emptyDir` @@ -171,6 +172,45 @@ writers simultaneously. See the [CephFS example](https://github.com/kubernetes/examples/tree/{{page.githubbranch}}/staging/volumes/cephfs/) for more details. +### configMap + +The [`configMap`](/docs/tasks/configure-pod-container/configmap/) resource +provides a way to inject configuration data into Pods. +The data stored in a `ConfigMap` object can be referenced in a volume of type +`configMap` and then consumed by containerized applications running in a Pod. + +When referencing a `configMap` object, you can simply provide its name in the +volume to reference it. You can also customize the path to use for a specific +entry in the ConfigMap. +For example, to mount the `log-config` ConfigMap onto a Pod called `configmap-pod`, +you might use the YAML below: + +```yaml +apiVersion: v1 +kind: Pod +metadata: + name: configmap-pod +spec: + containers: + - name: test + image: busybox + volumeMounts: + - name: config-vol + mountPath: /etc/config + volumes: + - name: config-vol + configMap: + name: log-config + items: + - key: log_level + path: log_level +``` + +The `log-config` ConfigMap is mounted as a volume, and all contents stored in +its `log_level` entry are mounted into the Pod at path "`/etc/config/log_level`". +Note that this path is derived from the volume's `mountPath` and the `path` +keyed with `log_level`. + ### csi CSI stands for [Container Storage Interface](https://github.com/container-storage-interface/spec/blob/master/spec.md),