How do I override per-instance settings in Spring Boot Admin when using Kubernetes discovery

4/30/2020

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.

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.

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.

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.)

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

Thanks in advance

Alan

-- wabrit
kubernetes
spring-boot-admin
spring-cloud

1 Answer

4/30/2020

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

  • 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.

e.g.

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

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

-- wabrit
Source: StackOverflow