From 9b3e181f5a91716d1d52a6291d790bd4c96b6734 Mon Sep 17 00:00:00 2001 From: Tim Bannister Date: Sun, 24 May 2020 12:03:02 +0100 Subject: [PATCH 1/2] Reword environment variable task - Use style guide convention for running commands Don't include the prompt, even for commands run inside a container - Call a manifest a manifest - tweak some wording --- .../define-environment-variable-container.md | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/content/en/docs/tasks/inject-data-application/define-environment-variable-container.md b/content/en/docs/tasks/inject-data-application/define-environment-variable-container.md index d10bbd323f..9c35c4db65 100644 --- a/content/en/docs/tasks/inject-data-application/define-environment-variable-container.md +++ b/content/en/docs/tasks/inject-data-application/define-environment-variable-container.md @@ -29,12 +29,12 @@ that run in the Pod. To set environment variables, include the `env` or 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 -value `"Hello from the environment"`. Here is the configuration file for the +value `"Hello from the environment"`. Here is the configuration manifest for the Pod: {{< codenew file="pods/inject/envars.yaml" >}} -1. Create a Pod based on the YAML configuration file: +1. Create a Pod based on that manifest: ```shell kubectl apply -f https://k8s.io/examples/pods/inject/envars.yaml @@ -46,7 +46,7 @@ Pod: kubectl get pods -l purpose=demonstrate-envars ``` - The output is similar to this: + The output is similar to: ``` NAME READY STATUS RESTARTS AGE @@ -62,7 +62,8 @@ Pod: 1. In your shell, run the `printenv` command to list the environment variables. ```shell - root@envar-demo:/# printenv + # Run this in the shell inside the container + printenv ``` The output is similar to this: @@ -80,12 +81,19 @@ Pod: {{< note >}} The environment variables set using the `env` or `envFrom` field -will override any environment variables specified in the container image. +override any environment variables specified in the container image. {{< /note >}} ## Using environment variables inside of your config -Environment variables that you define in a Pod's configuration can be used elsewhere in the configuration, for example in commands and arguments that you set for the Pod's containers. In the example configuration below, the `GREETING`, `HONORIFIC`, and `NAME` environment variables are set to `Warm greetings to`, `The Most Honorable`, and `Kubernetes`, respectively. Those environment variables are then used in the CLI arguments passed to the `env-print-demo` container. +Environment variables that you define in a Pod's configuration can be used +elsewhere in the configuration, for example in commands and arguments that +you set for the Pod's containers. +In the example configuration below, the `GREETING`, `HONORIFIC`, and +`NAME` environment variables are set to `Warm greetings to`, `The Most +Honorable`, and `Kubernetes`, respectively. Those environment variables +are then used in the CLI arguments passed to the `env-print-demo` +container. ```yaml apiVersion: v1 From a2de95e24343fe710daa93df468fedd274af54e7 Mon Sep 17 00:00:00 2001 From: Tim Bannister Date: Sun, 24 May 2020 12:04:31 +0100 Subject: [PATCH 2/2] Drop version check All supported Kubernetes releases let you set environment variables for Pods. --- .../define-environment-variable-container.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/en/docs/tasks/inject-data-application/define-environment-variable-container.md b/content/en/docs/tasks/inject-data-application/define-environment-variable-container.md index 9c35c4db65..5dd5aa92e0 100644 --- a/content/en/docs/tasks/inject-data-application/define-environment-variable-container.md +++ b/content/en/docs/tasks/inject-data-application/define-environment-variable-container.md @@ -14,7 +14,7 @@ in a Kubernetes Pod. {{% capture prerequisites %}} -{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}} +{{< include "task-tutorial-prereqs.md" >}} {{% /capture %}}