This might be a really stupid question, but I've wasted a lot of time trying to figure this out on my own. I struggle to translate the documentation. I don't speak elastic. I barely speak kubernetes. So I'll apologize in advance if I'm asking a dumb question.
Long story short: I need a way to set a static secret token created by the elastic operator when deploying apm. Every time APM is redeployed, the token changes. because the token is hard coded in our node projects, we obviously can't change this every time.
Is there a way to set a static token in the kubernetes deployment so it's always the same or is there some other method I can use to make sure projects always use the right token?
Kibana version:
7.6.2 Elasticsearch version:
7.6.2 APM Server version:
7.6.2
Original install method (e.g. download page, yum, deb, from source, etc.) and version:
Elastic Cloud on Kubernetes (ECK)
Fresh install or upgraded from other version?
Fresh
Is there anything special in your setup? For example, are you using the Logstash or Kafka outputs? Are you using a load balancer in front of the APM Servers? Have you changed index pattern, generated custom templates, changed agent configuration etc.
no
Every time APM is redeployed, the token changes. because the token is hard coded in our node projects, we obviously can't change this every time.
Out of curiosity, is this something that can be changed? Are your Node.js services running in Kubernetes? If so, you might be able to inject the secret token via the ELASTIC_APM_SECRET_TOKEN environment variable: Secrets | Kubernetes
Is there a way to set a static token in the kubernetes deployment so it's always the same or is there some other method I can use to make sure projects always use the right token?
The secret token is stored in a Kubernetes Secret: Run APM Server on ECK | Elastic Cloud on Kubernetes [2.10] | Elastic. If the secret already exists, and has the right labels, the ECK operator will use it instead of creating a new one. So what you could do is create the token before creating the ApmServer via ECK.
Great! Thanks Andrew, I'll give it a try. I didn't realize/never thought about creating the secret manually first. I'm pretty sure that will resolve my issue if it works.
We are using the 'ELASTIC_APM_SECRET_TOKEN' environment variable, but its value is still hardcoded in the dockerfile. It was just easier that way with Jenkins and all the automation we're implementing. But now that you've given me the idea, I suppose I could utilize jenkins or a bash script to grab the right value each time it builds.
See, I just needed a better mind to get me thinking of a different route. I'll give these idea a try. Thank you for your help. For the sake of anyone else this might help I'll report back how these worked out for me.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.