<p>I'm using Elastic Heartbeat in a Kubernetes Cluster.</p>
<p>I'm trying to setup google cloud platform module to Heartbeat, the documentation say:</p>
<pre><code>    metricbeat.modules:
    - module: googlecloud
      metricsets:
        - compute
      region: &quot;us-&quot;
      project_id: &quot;your project id&quot;
      credentials_file_path: &quot;your JSON credentials file path&quot;
      exclude_labels: false
      period: 1m
</code></pre>
<p>I have my credentials.json file to access to GCP, however, I can't put this credentials into kubernetes pod with Heartbeat.</p>
<p>I tried with a kubernetes secret, but the module configuration does not allow this. Just allow put a path.</p>
<p>How I can put this credentials into my heartbeat pod?</p>
<p>Thanks!</p>

<p>Solved!</p>
<p>I created a secret with my credentials.json file and I mounted the secret as volumen in the pod.</p>
<p>Configuration:</p>
<p>secret.yaml:</p>
<pre><code>apiVersion: v1
kind: Secret
metadata:
  name: credentials-secret
type: Opaque
stringData:
  sa_json: |
    {
      &quot;type&quot;: &quot;service_account&quot;,
      &quot;project_id&quot;: &quot;erased&quot;,
      &quot;private_key_id&quot;: &quot;erased&quot;,
      &quot;private_key&quot;: &quot;-----BEGIN PRIVATE KEY-----erased-----END PRIVATE KEY-----\n&quot;,
      &quot;client_email&quot;: &quot;erased&quot;,
      &quot;client_id&quot;: &quot;erased&quot;,
      &quot;auth_uri&quot;: &quot;https://accounts.google.com/o/oauth2/auth&quot;,
      &quot;token_uri&quot;: &quot;https://oauth2.googleapis.com/token&quot;,
      &quot;auth_provider_x509_cert_url&quot;: &quot;https://www.googleapis.com/oauth2/v1/certs&quot;,
      &quot;client_x509_cert_url&quot;: &quot;https://www.googleapis.com/robot/v1/metadata/x509/xxxxx.iam.gserviceaccount.com&quot;
    }

</code></pre>
<p>deployment.yaml:</p>
<pre><code>---
          volumeMounts:
          - mountPath: /etc/gcp
            name: service-account-credentials-volume
            readOnly: true
---
---
---
        volumes:
        - name: service-account-credentials-volume
          secret:
            secretName: credentials-secret
            items:
            - key: sa_json
              path: credentials.json
</code></pre>
