From 15e529958efb7eae66c9004c66ec5feaab96de89 Mon Sep 17 00:00:00 2001 From: Michael Fraenkel Date: Thu, 15 Dec 2016 12:46:03 -0500 Subject: [PATCH] Initial docs for envFrom ConfigMap --- .../define-environment-variable-container.md | 4 ++-- docs/user-guide/configmap/index.md | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/docs/tasks/configure-pod-container/define-environment-variable-container.md b/docs/tasks/configure-pod-container/define-environment-variable-container.md index 214142fa80..8242727b6a 100644 --- a/docs/tasks/configure-pod-container/define-environment-variable-container.md +++ b/docs/tasks/configure-pod-container/define-environment-variable-container.md @@ -22,8 +22,8 @@ in a Kubernetes Pod. ## Defining an environment variable for a container When you create a Pod, you can set environment variables for the containers -that run in the Pod. To set environment variables, include the `env` field in -the configuration file. +that run in the Pod. To set environment variables, include the `env` or +`envFrom` field in the configuration file. In this exercise, you create a Pod that runs one container. The configuration file for the Pod defines an environment variable with name `DEMO_GREETING` and diff --git a/docs/user-guide/configmap/index.md b/docs/user-guide/configmap/index.md index 3227e416c0..03a38a4ac6 100644 --- a/docs/user-guide/configmap/index.md +++ b/docs/user-guide/configmap/index.md @@ -244,8 +244,8 @@ metadata: ### Use-Case: Consume ConfigMap in environment variables -ConfigMaps can be used to populate environment variables. As an example, consider -the following ConfigMap: +ConfigMaps can be used to populate individual environment variables or used in +its entirety. As an example, consider the following ConfigMaps: ```yaml apiVersion: v1 @@ -258,6 +258,16 @@ data: special.type: charm ``` +```yaml +apiVersion: v1 +kind: ConfigMap +metadata: + name: env-config + namespace: default +data: + log_level: INFO +``` + We can consume the keys of this ConfigMap in a pod like so: ```yaml @@ -281,6 +291,9 @@ spec: configMapKeyRef: name: special-config key: special.type + envFrom: + - configMapRef: + name: env-config restartPolicy: Never ``` @@ -289,6 +302,7 @@ When this pod is run, its output will include the lines: ```shell SPECIAL_LEVEL_KEY=very SPECIAL_TYPE_KEY=charm +log_level=INFO ``` #### Optional ConfigMap in environment variables