<p>I have deployed app on GKE private cluster, and i have backend service, but the problem is that the backend service cant read the GOOGLE_ACCOUNT_PRIVATE_KEY, I am getting the following error:</p>
<pre><code>line 1526, in _handle_key_loading_error
    raise ValueError(&quot;Could not deserialize key data.&quot;)
ValueError: Could not deserialize key data.
</code></pre>
<p>This is part of the backend deployment where this env is found:</p>
<pre><code>env:
 - name: GOOGLE_ACCOUNT_PRIVATE_KEY
   valueFrom: 
     configMapKeyRef:
       name: gapk
       key: GOOGLE_ACCOUNT_PRIVATE_KEY
</code></pre>
<p>I have also other env that are successfully and i don't have any error for them</p>
<p>This is how i keep the GOOGLE_ACCOUNT_PRIVATE_KEY env:</p>
<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: gapk
data:
 GOOGLE_ACCOUNT_PRIVATE_KEY: '-----BEGIN PRIVATE KEY-----\private key\n-----END PRIVATE KEY-----\n'
</code></pre>
<p>with <code>&quot; &quot;</code> instead of <code>' '</code> is interpreted <code>\n</code> like new row but when i put the key in <code>' '</code> I have the serialize error, in both ways i got it wrong :(
Am I doing some mistake while decoding, also i put the original value of the key, not encoded in base64, and still getting the error <code> ValueError: Could not deserialize key data.</code></p>

Шурбески Христијан
<p>Have you tried replacing <code>\n</code> with <code>\\n</code>?</p>
<p>The other thing to try is just to remove the <code>\n</code>s and insert real newlines over mulitple lines. So long as the string is quoted it should be fine. The other thing to try is to remove the trailing newline since private key regex's not always consistent on this one.</p>
