简体   繁体   English

如何在 spring 启动应用程序中公开 SPLUNK_ACCESS_TOKEN

[英]How to expose SPLUNK_ACCESS_TOKEN in spring boot application

I have a spring boot application, in which I have imported the Splunk OTEL library(Splunk open telemetry jar file https://github.com/signalfx/splunk-otel-java ) for tracing and matrices. I have a spring boot application, in which I have imported the Splunk OTEL library(Splunk open telemetry jar file https://github.com/signalfx/splunk-otel-java ) for tracing and matrices. So a Splunk authentication token ie Splunk access token is needed to export data directly to Splunk Observability Cloud.因此,需要 Splunk 身份验证令牌(即 Splunk 访问令牌)将数据直接导出到 Splunk Observability Cloud。 Currently, I have exposed the Splunk access token in Kubernetes.yaml file as an env variable.目前,我已将 Kubernetes.yaml 文件中的 Splunk 访问令牌作为环境变量公开。 But I don't want to expose this token by using Kubernetes.yaml or using a properties file.但我不想通过使用 Kubernetes.yaml 或使用属性文件来公开此令牌。 So I just want to know, is there any other way to expose or store the splunk_acces_token apart from Kubernetes.yaml or properties file?所以我只想知道,除了 Kubernetes.yaml 或属性文件之外,还有其他方法可以公开或存储 splunk_acces_token 吗?

For example: there is a flag variable "OTEL_JAVAAGENT_ENABLED" used by the Splunk OTEL library and I have stored this value to "true" in kubernetes.yaml file.例如:Splunk OTEL 库使用了一个标志变量“OTEL_JAVAAGENT_ENABLED”,我已在 kubernetes.yaml 文件中将此值存储为“true”。 So by this config OTEL jar is able to access it.所以通过这个配置 OTEL jar 能够访问它。

In these cases it's common for developers to use some type of key vault to encrypt keys and store small secrets like passwords.在这些情况下,开发人员通常会使用某种类型的密钥库来加密密钥并存储密码等小秘密。

Here's how I use Azure tooling to achieve this:以下是我如何使用 Azure 工具来实现此目的:

  • Create an Azure Key Vault using Azure CLI使用 Azure CLI 创建 Azure 密钥保管库
  • Add accessToken secret and configure access to Azure Key Vault添加accessToken secret 并配置对 Azure Key Vault 的访问
  • Use accessToken in your pipeline在您的管道中使用accessToken

This depends on the stack you're using, for example in AWS you could store the secret in AWS Secrets Manager and pass it to CodePipeline.这取决于您使用的堆栈,例如在 AWS 中,您可以将密钥存储在 AWS Secrets Manager 中并将其传递给 CodePipeline。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM