<p>I need to store some passwords and usernames in the secrets.YAML .but after the deployment getting this error .so unable to build the secret and access it in the pods.
Attaching the deployment.yaml and secretes .yaml below.</p>

<p>--Secrets.yaml</p>

<pre class="lang-sh prettyprint-override"><code>    apiVersion: v1
    kind: Secret
    metadata:
      name: mysecret
    data:
       CassandraSettings__CassandraPassword: [[ .Environment ]]-abcd-cassandra-password
</code></pre>

<p>---Deployment.yaml</p>

<pre class="lang-sh prettyprint-override"><code>     env:
          - name: Password
            valueFrom:
                secretKeyRef:
                  name: mysecret
                  key: CassandraSettings__CassandraPassword

</code></pre>

<p>After deployment in TeamCity getting this error</p>

<blockquote>
  <p>Error from server (BadRequest): error when creating "STDIN": Secret in
  version "v1" cannot be handled as a Secret: v1.Secret.ObjectMeta:
  v1.ObjectMeta.TypeMeta: Kind: Data: decode base64: illegal base64 data
  at input byte 3, error found in #10 byte of
  ...|-password"},"kind":"|..., bigger context
  ...|_CassandraPassword":"dev-bling-cassandra-password"},"kind":"Secret","metadata":{"annotations":{"kube|...
  error parsing STDIN: error converting YAML to JSON: yaml: line 33: did
  not find expected '-' indicator</p>
</blockquote>

Riby Varghese
<p>Looks like type is missing, can you try as below,</p>

<p>---Secrets.yaml</p>

<pre class="lang-sh prettyprint-override"><code>apiVersion: v1
kind: Secret
metadata:
  name: mysecret
type: Opaque
data:
  CassandraSettings__CassandraPassword: [[ .Environment ]]-abcd-cassandra-password
</code></pre>

<p>---Deployment.yaml</p>

<pre class="lang-sh prettyprint-override"><code>    env:
      - name: Password
        valueFrom:
             secretKeyRef:
               name: mysecret
               key: CassandraSettings__CassandraPassword
</code></pre>
