使用Kubernetes发现时如何在Spring Boot Admin中覆盖每个实例的设置 [英] How do I override per-instance settings in Spring Boot Admin when using Kubernetes discovery

查看:139
本文介绍了使用Kubernetes发现时如何在Spring Boot Admin中覆盖每个实例的设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行Spring Boot Admin服务器(2.2.2),并使用Spring Cloud Kubernetes发现(带有要过滤的特定服务标签)来检测我的客户端应用程序.我的客户端应用程序都没有使用显式的Spring Boot Admin 客户端依赖性机制.

I'm running a Spring Boot Admin server (2.2.2) and using Spring Cloud Kubernetes discovery (with specific service labels to filter) to detect my client apps. None of my client apps are using the explicit Spring Boot Admin Client dependency mechanism.

我的一个客户端应用程序具有非标准的执行器URL,并使用不同的安全凭证来访问这些端点.我了解我可以使用静态弹簧云发现和实例元数据来实现此目的,但我宁愿对所有客户端应用程序都使用kubernetes发现过程.

One of my client apps has a non-standard actuator URL and uses different security credentials to access those endpoints. I understand that I could use static spring cloud discovery with instance metadata to achieve this, but I'd rather use the kubernetes discovery process for all my client apps.

我认为通过使用自定义 ServiceInstanceConverter ,我可能是能够覆盖管理上下文路径,但我看不到通过该路由注入自定义安全凭证的方法.

I think by using a custom ServiceInstanceConverter I might be able to override the management context path, but I couldn't see a way to inject custom security credentials via that route.

是否有更好的方法来定制此kubernetes驱动的发现过程?(例如,我可以在客户端应用程序中的某个位置声明实例元数据,以便即使我使用Kubernetes发现时也可以将其提取)-我从Spring Boot Admin文档中了解到,在客户端中设置管理员属性仅适用于从...推送注册"客户端到服务器"的情况,而不是服务器发现"的情况.)

Is there a better way to customise this kubernetes-driven discovery process? (e.g. can I declare instance metadata somewhere in the client app so that it's picked up even though I'm using Kubernetes discovery - I got the sense from the Spring Boot Admin docs that setting admin properties in clients applied only to the "push registration from client to server" case rather than the "server discovers" case.)

作为一个相关的一般性问题,Spring Boot Admin大概使用一些 default 凭证值来访问执行器端点-它们在哪里设置?

As a related general question, Spring Boot Admin is presumably using some default credential values for accessing actuator endpoints - where are they set up?

预先感谢

艾伦

推荐答案

我想我自己解决了这个问题,但是如果对其他人有用,这就是我所做的:

I think I figured this out for myself, but in case it's useful to anyone else here is what I did:

  • 为我的客户端应用程序的Kubernetes服务的 annotations 部分下的实例元数据management.context-path,user.name和user.password声明了自定义值.
  • Declared custom values for the instance metadata management.context-path, user.name and user.password under the annotations section of the Kubernetes service for my client application.

例如

kind: Service
apiVersion: v1
metadata:
  name: foo-service
  annotations:
    # The following are used to support monitoring and administration
    user.name: mySpecialUsername
    user.password: mySpecialPassword
    management.context-path: /foo/manage

从观察结果看,Spring Boot Administration服务器假定的默认凭据为 admin/admin .

From observation it seems that the default credentials assumed by a Spring Boot Administration server are admin/admin.

这篇关于使用Kubernetes发现时如何在Spring Boot Admin中覆盖每个实例的设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆