<p>How i can access or read windows environment variable in kubernetes. I achieved the same in docker compose file.</p>
<p>How i can do the same in kubernetes as i am unable to read the windows environment variables?</p>

Shujaat Ali
<p>Nothing in the standard Kubernetes ecosystem can be configured using host environment variables.</p>
<p>If you're using the core <code>kubectl</code> tool, the YAML files you'd feed into <code>kubectl apply</code> are self-contained manifests; they cannot depend on host files or environment variables.  This can be wrapped in a second tool, <a href="https://kustomize.io" rel="nofollow noreferrer">Kustomize</a>, which can apply some modifications, but that explicitly <a href="https://kubectl.docs.kubernetes.io/faq/kustomize/eschewedfeatures/#build-time-side-effects-from-cli-args-or-env-variables" rel="nofollow noreferrer">does not support host environment variables</a>.  <a href="https://helm.sh" rel="nofollow noreferrer">Helm</a> lets you build Kubernetes manifests using a templating language, but that also specifically <a href="https://helm.sh/docs/howto/charts_tips_and_tricks/#know-your-template-functions" rel="nofollow noreferrer">does not use host environment variables</a>.</p>
<p>You'd need to somehow inject the environment variable value into one of these deployment systems.  With all three of these tools, you could include those in a file (a Kubernetes YAML manifest, a Kustomize overlay, a Helm values file) that could be checked into source control; you may also be able to retrieve these values from some sort of external storage.  But just relaying host environment variables into a container isn't an option in Kubernetes.</p>
