title: Kubernetes - Storing jks file in secrets or configMap
body: <p>I have a keystore.jks file which I need to pass as a env variable for my docker process.</p>
  
  <p>I used the below command to store the file as a secret.</p>
  
  <blockquote>
    <p>kubectl create secret generic ssl-keystore-cert
    --from-file=./keystore.jks</p>
  </blockquote>
  
  <p>Using the above secret in my deployment.yaml as below.</p>
  
  <pre><code>{
              "name": "SERVER_SSL_KEYSTORE",
              "valueFrom": {
                "secretKeyRef": {
                  "name": "ssl-keystore-cert",
                  "key": "keystore.jks"
                }
              }
            }
  </code></pre>
  
  <blockquote>
    <p>Error: failed to start container "app-service": Error response from
    daemon: oci runtime error: container_linux.go:265: starting container
    process caused "process_linux.go:368: container init caused \"setenv:
    invalid argument\"" Back-off restarting failed container</p>
  </blockquote>
  
  <p>Is there anyway to store the keystore.jks in secret or configmap?</p>
  
  <p><strong>Debug :-</strong></p>
  
  <blockquote>
    <p>kubectl describe secret ssl-keystore-cert</p>
  </blockquote>
  
  <pre><code>Name:         ssl-keystore-cert
  Labels:       &lt;none&gt;
  Annotations:  &lt;none&gt;
  
  Type:  Opaque
  
  Data
  ====
  keystore.jks:  4818 bytes
  </code></pre>