Merge pull request #6766 from tengqm/fix-2385
Add configMap as a volume type
This commit is contained in:
@@ -69,6 +69,7 @@ Kubernetes supports several types of Volumes:
|
|||||||
* `azureDisk`
|
* `azureDisk`
|
||||||
* `azureFile`
|
* `azureFile`
|
||||||
* `cephfs`
|
* `cephfs`
|
||||||
|
* `configMap`
|
||||||
* `csi`
|
* `csi`
|
||||||
* `downwardAPI`
|
* `downwardAPI`
|
||||||
* `emptyDir`
|
* `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.
|
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
|
||||||
|
|
||||||
CSI stands for [Container Storage Interface](https://github.com/container-storage-interface/spec/blob/master/spec.md),
|
CSI stands for [Container Storage Interface](https://github.com/container-storage-interface/spec/blob/master/spec.md),
|
||||||
|
|||||||
Reference in New Issue
Block a user