<p>I have a config json file in my application. This is single json file which has all configs required for my nodejs application. I have many connections to many db'. I even have bifurcation like stage and production. I don't want to create secret for each variable. I want to dump my complete JSON as secret. So that i can directly pick it up from there and use in my application. 
Anyway i can achieve it? I think its a generic problem. </p>

Hacker
<p>The simple solution is to put the entire config file under <code>stringData</code> in the secret. Something like that:</p>

<pre><code>apiVersion: v1
kind: Secret
metadata:
  name: mysecret
type: Opaque
stringData:
  config.json: |
   &lt;your config goes here&gt;
</code></pre>

<p>Now you can just <a href="https://kubernetes.io/docs/concepts/configuration/secret/#using-secrets-as-files-from-a-pod" rel="nofollow noreferrer">mount</a> the secret onto the pod , and you can read this config file.</p>

<p>While this work, it might be harder to use with GitOps solution, which usually requires you to encrypt the entire secret content. Using <a href="https://kamus.soluto.io" rel="nofollow noreferrer">Kamus</a>, you can create templated config file with encrypted values, in the following format:</p>

<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: encrypted-secrets-cm
data:
  key: 4AD7lM6lc4dGvE3oF+5w8g==:WrcckiNNOAlMhuWHaM0kTw== //encrypted
  template.ejs: |
     &lt;%- secrets["key"] %&gt;
     hello
</code></pre>

<p>And use the <a href="https://github.com/Soluto/kamus/tree/master/init-container" rel="nofollow noreferrer">init container</a> to create the config file with the decrypted values. The value with the encrypted items can be safely committed to git.</p>
