# Keep elastic cloud credentials separately & securly

**URL:** https://discuss.elastic.co/t/keep-elastic-cloud-credentials-separately-securly/202413
**Category:** Beats
**Tags:** metricbeat
**Created:** [October 5, 2019, 4:04am UTC](https://discuss.elastic.co/t/keep-elastic-cloud-credentials-separately-securly/202413 "2019-10-05T04:04:21Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![elikesha](https://avatars.discourse-cdn.com/v4/letter/e/73ab20/32.png) [@elikesha](https://discuss.elastic.co/u/elikesha)
#### Post date: [October 5, 2019, 4:04am UTC](https://discuss.elastic.co/t/keep-elastic-cloud-credentials-separately-securly/202413/1 "2019-10-05T04:04:21Z")

</div>

I am using metricbeat to monitor the K8s cluster. I was using the following config,

[https://raw.githubusercontent.com/elastic/beats/7.4/deploy/kubernetes/metricbeat-kubernetes.yaml](https://raw.githubusercontent.com/elastic/beats/7.4/deploy/kubernetes/metricbeat-kubernetes.yaml)

Here elastic cloud creds are referred like cloud.id: {ELASTIC\_CLOUD\_ID}, I am struggling to feed the credentials. Where should I define the {ELASTIC\_CLOUD\_ID}? I tried setting as an environment variable but the value is not replaced when execute the  
kubectl apply -f metricbeat-kubernetes-7.4.yaml

Note: Hardcoding the cloud.id in the metricbeat-kubernetes-7.4.yaml is an option (it works fine with that) but I cannot commit the config file to Github with the credentials.

What is the best way to handle that?  
I don't think config map with variable an option here.

---

<div class="post-metadata">

### Author: ![elikesha](https://avatars.discourse-cdn.com/v4/letter/e/73ab20/32.png) [@elikesha](https://discuss.elastic.co/u/elikesha)
#### Post date: [October 5, 2019, 4:54am UTC](https://discuss.elastic.co/t/keep-elastic-cloud-credentials-separately-securly/202413/2 "2019-10-05T04:54:19Z")

</div>

Found the answer, posting for others benefit,  
The solution is very well documented on [https://github.com/elastic/examples/blob/master/beats-k8s-send-anywhere/README-Cloud.md](https://github.com/elastic/examples/blob/master/beats-k8s-send-anywhere/README-Cloud.md)

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [November 2, 2019, 4:54am UTC](https://discuss.elastic.co/t/keep-elastic-cloud-credentials-separately-securly/202413/3 "2019-11-02T04:54:20Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
