# Go-template certificate parse error

**URL:** <https://discuss.elastic.co/t/go-template-certificate-parse-error/262986>\
**Category:** Elastic Cloud on Kubernetes (ECK)\
**Tags:** elastic-stack-security\
**Created:** [February 2, 2021, 1:33pm UTC](https://discuss.elastic.co/t/go-template-certificate-parse-error/262986 "2021-02-02T13:33:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Srinivas\_RK](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/srinivas_rk/32/83303_2.png) [@Srinivas\_RK](https://discuss.elastic.co/u/Srinivas_RK)\
**Post date:** [February 2, 2021, 1:33pm UTC](https://discuss.elastic.co/t/go-template-certificate-parse-error/262986/1 "2021-02-02T13:33:25Z")

</div>

trying to get certificates and install as mentioned here but  
[here](https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-tls-certificates.html)

not able to run the command mentioned here

kubectl get secret my-elastic-depl-es-http-certs-public -o go-template='{{index .data "tls.crt" | base64decode }}' \> tls.crt  
`error: error parsing template {{index .data tls.crt | base64decode }}, template: output:1: function "tls" not defined`

im on windows10 and using azure aks cluster

---

<div class="post-metadata">

**Author:** ![michael.morello](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michael.morello/32/47448_2.png) [@michael.morello](https://discuss.elastic.co/u/michael.morello)\
**Post date:** [February 2, 2021, 1:54pm UTC](https://discuss.elastic.co/t/go-template-certificate-parse-error/262986/2 "2021-02-02T13:54:02Z")

</div>

This is the error you get if you forgot the quotes around `tls.crt`, at least on MacOS or Linux with `kubectl` v1.19.

Could you double check that you put them in your command ?

---

<div class="post-metadata">

**Author:** ![Srinivas\_RK](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/srinivas_rk/32/83303_2.png) [@Srinivas\_RK](https://discuss.elastic.co/u/Srinivas_RK)\
**Post date:** [February 2, 2021, 1:56pm UTC](https://discuss.elastic.co/t/go-template-certificate-parse-error/262986/3 "2021-02-02T13:56:43Z")

</div>

i actually ran this command  
`kubectl get secret banana-elastic-depl-es-http-certs-public -o go-template='{{index .data "tls.crt" | base64decode }}' > tls.crt`  
above is error i got

---

<div class="post-metadata">

**Author:** ![Srinivas\_RK](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/srinivas_rk/32/83303_2.png) [@Srinivas\_RK](https://discuss.elastic.co/u/Srinivas_RK)\
**Post date:** [February 2, 2021, 9:11pm UTC](https://discuss.elastic.co/t/go-template-certificate-parse-error/262986/4 "2021-02-02T21:11:37Z")

</div>

`kubectl get secret elastic-depl-es-http-certs-public -o go-template='{{index .data \"tls.crt\" | base64decode }}' > tls.crt`

this fixed on windows powershell

---

<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 4, 2022, 8:23am UTC](https://discuss.elastic.co/t/go-template-certificate-parse-error/262986/5 "2022-11-04T08:23:09Z")

</div>


