1.2 additions for user-guide/
This commit is contained in:
@@ -1,8 +1,3 @@
|
||||
<!-- BEGIN MUNGE: UNVERSIONED_WARNING -->
|
||||
|
||||
|
||||
<!-- END MUNGE: UNVERSIONED_WARNING -->
|
||||
|
||||
# ConfigMap example
|
||||
|
||||
|
||||
@@ -11,21 +6,21 @@
|
||||
|
||||
This example assumes you have a Kubernetes cluster installed and running, and that you have
|
||||
installed the `kubectl` command line tool somewhere in your path. Please see the [getting
|
||||
started](../../../docs/getting-started-guides/) for installation instructions for your platform.
|
||||
started](http://kubernetes.io/docs/getting-started-guides/) for installation instructions for your platform.
|
||||
|
||||
## Step One: Create the ConfigMap
|
||||
|
||||
A ConfigMap contains a set of named strings.
|
||||
|
||||
Use the [`examples/configmap/configmap.yaml`](configmap.yaml) file to create a ConfigMap:
|
||||
Use the [`configmap.yaml`](configmap.yaml) file to create a ConfigMap:
|
||||
|
||||
```console
|
||||
```shell
|
||||
$ kubectl create -f docs/user-guide/configmap/configmap.yaml
|
||||
```
|
||||
|
||||
You can use `kubectl` to see information about the ConfigMap:
|
||||
|
||||
```console
|
||||
```shell
|
||||
$ kubectl get configmap
|
||||
NAME DATA
|
||||
test-secret 2
|
||||
@@ -43,7 +38,7 @@ data-2: 7 bytes
|
||||
|
||||
View the values of the keys with `kubectl get`:
|
||||
|
||||
```console
|
||||
```shell
|
||||
$ cluster/kubectl.sh get configmaps test-configmap -o yaml
|
||||
apiVersion: v1
|
||||
data:
|
||||
@@ -61,16 +56,16 @@ metadata:
|
||||
|
||||
## Step Two: Create a pod that consumes a configMap in environment variables
|
||||
|
||||
Use the [`examples/configmap/env-pod.yaml`](env-pod.yaml) file to create a Pod that consumes the
|
||||
Use the [`env-pod.yaml`](env-pod.yaml) file to create a Pod that consumes the
|
||||
ConfigMap in environment variables.
|
||||
|
||||
```console
|
||||
```shell
|
||||
$ kubectl create -f docs/user-guide/configmap/env-pod.yaml
|
||||
```
|
||||
|
||||
This pod runs the `env` command to display the environment of the container:
|
||||
|
||||
```console
|
||||
```shell
|
||||
$ kubectl logs secret-test-pod
|
||||
KUBE_CONFIG_1=value-1
|
||||
KUBE_CONFIG_2=value-2
|
||||
@@ -78,40 +73,29 @@ KUBE_CONFIG_2=value-2
|
||||
|
||||
## Step Three: Create a pod that sets the command line using ConfigMap
|
||||
|
||||
Use the [`examples/configmap/command-pod.yaml`](env-pod.yaml) file to create a Pod with a container
|
||||
Use the [`command-pod.yaml`](env-pod.yaml) file to create a Pod with a container
|
||||
whose command is injected with the keys of a ConfigMap
|
||||
|
||||
```console
|
||||
```shell
|
||||
$ kubectl create -f docs/user-guide/configmap/env-pod.yaml
|
||||
```
|
||||
|
||||
This pod runs an `echo` command to display the keys:
|
||||
|
||||
```console
|
||||
```shell
|
||||
value-1 value-2
|
||||
```
|
||||
|
||||
## Step Four: Create a pod that consumes a configMap in a volume
|
||||
|
||||
Pods can also consume ConfigMaps in volumes. Use the [`examples/configmap/volume-pod.yaml`](volume-pod.yaml) file to create a Pod that consume the ConfigMap in a volume.
|
||||
Pods can also consume ConfigMaps in volumes. Use the [`volume-pod.yaml`](volume-pod.yaml) file to create a Pod that consume the ConfigMap in a volume.
|
||||
|
||||
```console
|
||||
```shell
|
||||
$ 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:
|
||||
|
||||
```console
|
||||
```shell
|
||||
value-1
|
||||
```
|
||||
|
||||
|
||||
|
||||
<!-- BEGIN MUNGE: IS_VERSIONED -->
|
||||
<!-- TAG IS_VERSIONED -->
|
||||
<!-- END MUNGE: IS_VERSIONED -->
|
||||
|
||||
|
||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
||||
[]()
|
||||
<!-- END MUNGE: GENERATED_ANALYTICS -->
|
||||
```
|
||||
Reference in New Issue
Block a user