<p>I am  currently learning Kubernetes, and i am facing a bit of a wall.
I try to pass environmentalvariables from my YAML file  definition
to my container. But the variables seem not to be present afterwards.
<code>kubectl exec &lt;pod name&gt;  -- printenv</code> gives me the list of environmental
variables. But the ones i defined in my YAML file is  not present.</p>
<p>I defined the environment variables in my deployment as shown  below:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: hello-world-boot
  labels:
    app: hello-world-boot
spec:
  selector:
    matchLabels:
      app: hello-world-boot
  template:
    metadata:
      labels:
        app: hello-world-boot
  containers:
    - name: hello-world-boot
      image: lightmaze/hello-world-spring:latest
      env:
        - name: HELLO
          value: &quot;Hello there&quot;
        - name: WORLD
          value: &quot;to the entire world&quot;
      resources:
        limits:
          memory: &quot;128Mi&quot;
          cpu: &quot;500m&quot;
      ports:
        - containerPort: 8080
    selector:
    app: hello-world-boot
</code></pre>
<p>Hopefully someone can see where i failed in the YAML :)</p>

<p>If I correct the errors in your <code>Deployment</code> configuration so that it looks like this:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: hello-world-boot
  labels:
    app: hello-world-boot
spec:
  selector:
    matchLabels:
      app: hello-world-boot
  template:
    metadata:
      labels:
        app: hello-world-boot
    spec:
      containers:
        - name: hello-world-boot
          image: lightmaze/hello-world-spring:latest
          env:
            - name: HELLO
              value: &quot;Hello there&quot;
            - name: WORLD
              value: &quot;to the entire world&quot;
          resources:
            limits:
              memory: &quot;128Mi&quot;
              cpu: &quot;500m&quot;
          ports:
            - containerPort: 8080
</code></pre>
<p>And deploy it into my local <code>minikube</code> instance:</p>
<pre><code>$ kubectl apply -f pod.yml
</code></pre>
<p>Then it seems to work as you intended:</p>
<pre><code>$ kubectl exec -it hello-world-boot-7568c4d7b5-ltbbr -- printenv
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/jvm/java-1.8-openjdk/jre/bin:/usr/lib/jvm/java-1.8-openjdk/bin
HOSTNAME=hello-world-boot-7568c4d7b5-ltbbr
TERM=xterm
HELLO=Hello there
WORLD=to the entire world
KUBERNETES_PORT_443_TCP=tcp://10.96.0.1:443
KUBERNETES_PORT_443_TCP_PROTO=tcp
KUBERNETES_PORT_443_TCP_PORT=443
KUBERNETES_PORT_443_TCP_ADDR=10.96.0.1
KUBERNETES_SERVICE_HOST=10.96.0.1
KUBERNETES_SERVICE_PORT=443
KUBERNETES_SERVICE_PORT_HTTPS=443
KUBERNETES_PORT=tcp://10.96.0.1:443
LANG=C.UTF-8
JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk
JAVA_VERSION=8u212
JAVA_ALPINE_VERSION=8.212.04-r0
HOME=/home/spring
</code></pre>
<p>If you look at the above output, you can see both the <code>HELLO</code> and <code>WORLD</code> environment variables you defined in your <code>Deployment</code>.</p>
