Fix configmap docs

pull/289/head
Janet Kuo 2016-03-30 11:34:30 -07:00
parent 4cbce7619f
commit 1775b0a809
2 changed files with 29 additions and 29 deletions

View File

@ -22,8 +22,8 @@ You can use `kubectl` to see information about the ConfigMap:
```shell ```shell
$ kubectl get configmap $ kubectl get configmap
NAME DATA NAME DATA AGE
test-secret 2 test-configmap 2 6s
$ kubectl describe configMap test-configmap $ kubectl describe configMap test-configmap
Name: test-configmap Name: test-configmap
@ -39,7 +39,7 @@ data-2: 7 bytes
View the values of the keys with `kubectl get`: View the values of the keys with `kubectl get`:
```shell ```shell
$ cluster/kubectl.sh get configmaps test-configmap -o yaml $ kubectl get configmaps test-configmap -o yaml
apiVersion: v1 apiVersion: v1
data: data:
data-1: value-1 data-1: value-1
@ -66,23 +66,24 @@ $ kubectl create -f docs/user-guide/configmap/env-pod.yaml
This pod runs the `env` command to display the environment of the container: This pod runs the `env` command to display the environment of the container:
```shell ```shell
$ kubectl logs secret-test-pod $ kubectl logs config-env-test-pod | grep KUBE_CONFIG
KUBE_CONFIG_1=value-1 KUBE_CONFIG_1=value-1
KUBE_CONFIG_2=value-2 KUBE_CONFIG_2=value-2
``` ```
## Step Three: Create a pod that sets the command line using ConfigMap ## Step Three: Create a pod that sets the command line using ConfigMap
Use the [`command-pod.yaml`](env-pod.yaml) file to create a Pod with a container Use the [`command-pod.yaml`](command-pod.yaml) file to create a Pod with a container
whose command is injected with the keys of a ConfigMap whose command is injected with the keys of a ConfigMap
```shell ```shell
$ kubectl create -f docs/user-guide/configmap/env-pod.yaml $ kubectl create -f docs/user-guide/configmap/command-pod.yaml
``` ```
This pod runs an `echo` command to display the keys: This pod runs an `echo` command to display the keys:
```shell ```shell
$ kubectl logs config-cmd-test-pod
value-1 value-2 value-1 value-2
``` ```
@ -97,5 +98,6 @@ $ kubectl create -f docs/user-guide/configmap/volume-pod.yaml
This pod runs a `cat` command to print the value of one of the keys in the volume: This pod runs a `cat` command to print the value of one of the keys in the volume:
```shell ```shell
$ kubectl logs config-volume-test-pod
value-1 value-1
``` ```

View File

@ -91,7 +91,7 @@ content of the file.
Let's take a look at the ConfigMap that this command created: Let's take a look at the ConfigMap that this command created:
```shell ```shell
$ cluster/kubectl.sh describe configmaps game-config $ kubectl describe configmaps game-config
Name: game-config Name: game-config
Namespace: default Namespace: default
Labels: <none> Labels: <none>
@ -147,7 +147,7 @@ following command yields equivalent results to the above example:
```shell ```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
$ cluster/kubectl.sh get configmaps game-config-2 -o yaml $ kubectl get configmaps game-config-2 -o yaml
``` ```
```yaml ```yaml
@ -267,13 +267,13 @@ spec:
- name: SPECIAL_LEVEL_KEY - name: SPECIAL_LEVEL_KEY
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: special-configmap name: special-config
key: special.how key: special.how
- name: SPECIAL_TYPE_KEY - name: SPECIAL_TYPE_KEY
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: special-config name: special-config
key: data-1 key: special.type
restartPolicy: Never restartPolicy: Never
``` ```
@ -318,13 +318,13 @@ spec:
- name: SPECIAL_LEVEL_KEY - name: SPECIAL_LEVEL_KEY
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: special-configmap name: special-config
key: special.how key: special.how
- name: SPECIAL_TYPE_KEY - name: SPECIAL_TYPE_KEY
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: special-config name: special-config
key: data-1 key: special.type
restartPolicy: Never restartPolicy: Never
``` ```
@ -427,25 +427,23 @@ ConfigMap instance with it:
```shell ```shell
$ kubectl create configmap example-redis-config --from-file=docs/user-guide/configmap/redis/redis-config $ kubectl create configmap example-redis-config --from-file=docs/user-guide/configmap/redis/redis-config
$ kubectl get configmap redis-config -o yaml $ kubectl get configmap example-redis-config -o yaml
``` ```
```yaml ```yaml
{ apiVersion: v1
"kind": "ConfigMap", data:
"apiVersion": "v1", redis-config: |
"metadata": { maxmemory 2mb
"name": "example-redis-config", maxmemory-policy allkeys-lru
"namespace": "default", kind: ConfigMap
"selfLink": "/api/v1/namespaces/default/configmaps/example-redis-config", metadata:
"uid": "07fd0419-d97b-11e5-b443-68f728db1985", creationTimestamp: 2016-03-30T18:14:41Z
"resourceVersion": "15", name: example-redis-config
"creationTimestamp": "2016-02-22T15:43:34Z" namespace: default
}, resourceVersion: "24686"
"data": { selfLink: /api/v1/namespaces/default/configmaps/example-redis-config
"redis-config": "maxmemory 2mb\nmaxmemory-policy allkeys-lru\n" uid: 460a2b6e-f6a3-11e5-8ae5-42010af00002
}
}
``` ```
Now, let's create a pod that uses this config: Now, let's create a pod that uses this config: