<p>I am looking for something equivalent to SPRING_APPLICATION_JSON env variable of Docker Compose in Kubernetes Deployment yaml.</p>

<p>I am aware of that we can pass individual config as name-value pair. But there must be something through which all env variables can be passed in json or yaml format in Kubernetes.</p>

Infotechie
<p>You can do that using <strong>ConfigMap</strong>. For example, create a configmap:</p>

<pre><code>kind: ConfigMap
apiVersion: v1
metadata:
  name: appconfig
data:
  ENV_KEY1: val1
  ENV_KEY2: val2
</code></pre>

<p>Then in your deployment container, use</p>

<pre><code>spec:
  containers:
  - image: &lt;image&gt;
    name: &lt;name&gt;
    envFrom:
    - configMapRef:
        name: appconfig
</code></pre>
