diff --git a/docs/tasks/configure-pod-container/configmap.md b/docs/tasks/configure-pod-container/configmap.md index abccc6bf19..c8bb5aa536 100644 --- a/docs/tasks/configure-pod-container/configmap.md +++ b/docs/tasks/configure-pod-container/configmap.md @@ -11,7 +11,7 @@ redirect_from: {% capture overview %} -This page shows you how to configure an application using a ConfigMap. +This page shows you how to configure an application using a ConfigMap. {% endcapture %} @@ -24,7 +24,7 @@ This page shows you how to configure an application using a ConfigMap. {% capture steps %} -## Use kubectl to create a ConfigMap +## Use kubectl to create a ConfigMap Use the `kubectl create configmap` command to create configmaps from [directories](#creating-configmaps-from-directories), [files](#creating-configmaps-from-files), or [literal values](#creating-configmaps-from-literal-values): @@ -33,17 +33,17 @@ kubectl create configmap ``` where \ is the name you want to assign to the ConfigMap and \ is the directory, file, or literal value to draw the data from. - + The data source corresponds to a key-value pair in the ConfigMap, where -* key = the file name or the key you provided on the command line, and +* key = the file name or the key you provided on the command line, and * value = the file contents or the literal value you provided on the command line. - + You can use [`kubectl describe`](docs/user-guide/kubectl/v1.6/#describe) or [`kubectl get`](docs/user-guide/kubectl/v1.6/#get) to retrieve information about a ConfigMap. The former shows a summary of the ConfigMap, while the latter returns the full contents of the ConfigMap. ### Create ConfigMaps from directories -You can use `kubectl create configmap` to create a ConfigMap from multiple files in the same directory. +You can use `kubectl create configmap` to create a ConfigMap from multiple files in the same directory. For example: @@ -110,10 +110,10 @@ metadata: You can use `kubectl create configmap` to create a ConfigMap from an individual file, or from multiple files. -For example, +For example, ```shell -kubectl create configmap game-config-2 --from-file=docs/user-guide/configmap/kubectl/game.properties +kubectl create configmap game-config-2 --from-file=docs/user-guide/configmap/kubectl/game.properties ``` would produce the following ConfigMap: @@ -131,9 +131,9 @@ game.properties: 158 bytes ``` You can pass in the `--from-file` argument multiple times to create a ConfigMap from multiple data sources. - + ```shell -kubectl create configmap game-config-2 --from-file=docs/user-guide/configmap/kubectl/game.properties --from-file=docs/user-guide/configmap/kubectl/ui.properties +kubectl create configmap game-config-2 --from-file=docs/user-guide/configmap/kubectl/game.properties --from-file=docs/user-guide/configmap/kubectl/ui.properties ``` ```shell @@ -158,8 +158,8 @@ kubectl create configmap game-config-3 --from-file== ``` where `` is the key you want to use in the ConfigMap and `` is the location of the data source file you want the key to represent. - -For example: + +For example: ```shell kubectl create configmap game-config-3 --from-file=game-special-key=docs/user-guide/configmap/kubectl/game.properties @@ -219,37 +219,6 @@ metadata: {% endcapture %} -{% capture discussion %} - -## Understanding ConfigMaps - -ConfigMaps allow you to decouple configuration artifacts from image content to keep containerized applications portable. -The ConfigMap API resource stores configuration data as key-value pairs. The data can be consumed in pods or provide the configurations for system components such as controllers. ConfigMap is similar to [Secrets](/docs/concepts/configuration/secret/), but provides a means of working with strings that don't contain sensitive information. Users and system components alike can store configuration data in ConfigMap. - -Note: ConfigMaps should reference properties files, not replace them. Think of the ConfigMap as representing something similar to the a Linux `/etc` directory and its contents. For example, if you create a [Kubernetes Volume](/docs/concepts/storage/volumes/) from a ConfigMap, each data item in the ConfigMap is represented by an individual file in the volume. - -The ConfigMap's `data` field contains the configuration data. As shown in the example below, this can be simple -- like individual properties defined using `--from-literal` -- or complex -- like configuration files or JSON blobs defined using `--from-file`. - -```yaml -kind: ConfigMap -apiVersion: v1 -metadata: - creationTimestamp: 2016-02-18T19:14:38Z - name: example-config - namespace: default -data: - # example of a simple property defined using --from-literal - example.property.1: hello - example.property.2: world - # example of a complex property defined using --from-file - example.property.file: |- - property.1=value-1 - property.2=value-2 - property.3=value-3 -``` - -{% endcapture %} - {% capture whatsnext %} * See [Using ConfigMap Data in Pods](/docs/tasks/configure-pod-container/configure-pod-configmap). * Follow a real world example of [Configuring Redis using a ConfigMap](/docs/tutorials/configuration/configure-redis-using-configmap/).