<p>I am using <code>Firebase</code> in my <code>GoLang</code> project hosted on <code>Google Kubernetes Engine</code>.</p>
<p>Steps I followed:</p>
<ol>
<li><p>Enable firebase admin SDK on the firebase account. It generated a service account <code>JSON</code> for me. This also created a service account under my Google console service credentials.</p>
</li>
<li><p>Followed this <a href="https://stackoverflow.com/a/50297314/834239">answer</a> and add a new secret key using <code>kubectl create secret generic google-application-credentials --from-file=./sample-project.json</code></p>
</li>
<li><p>Made changes to my <code>deployment.YAML</code> file (added volume mounts, and environment variable in)</p>
<pre><code>spec:
  containers:
  - image: gcr.io/sample-ee458/city:0.27
  name: city-app
  volumeMounts:
  - name: google-application-credentials-volume
    mountPath: /etc/gcp
    readOnly: true 
env:
- name: GOOGLE_APPLICATION_CREDENTIALS
  value: /etc/gcp/application-credentials.json
</code></pre>
</li>
<li><p>setup volume in the same file</p>
<pre><code>volumes:
- name: google-application-credentials-volume
secret:
  secretName: google-application-credentials
  items:
  - key: application-credentials.json # default name created by the create secret from-file command
  path: application-credentials.json
</code></pre>
</li>
<li><p>Run <code>kubectl apply -f deployment.yaml</code> and deploy using <code>docker push</code> command.</p>
</li>
</ol>
<p>It's throwing me <code>error getting credentials using google_application_credentials environment variable gke</code>. What am I missing here? Anny hint would be appreciable.</p>

Amit Pal
<p>Finally, I figure out how to copy it and use the environment variable. Here is. the updated <code>YAML</code>file</p>
<pre><code>apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: my-app
spec:
  template:
    spec:
      volumes:
      - name: google-cloud-keys
        secret:
          secretName: gac-keys
      containers:
      - name: my-app
        image: us.gcr.io/my-app
        volumeMounts:
        - name: google-cloud-keys
          mountPath: /var/secrets/google
          readOnly: true
        env:
        - name: GOOGLE_APPLICATION_CREDENTIALS
          value: /var/secrets/google/new-file-name.json
</code></pre>
