上一章节讲述了ingress怎么配置的问题,并且结合spritngbootadmin案例讲解。
跳转:/article/k8szmbzingressdhttpszshspringbootzsyz(springboot-adminlz
但是关于springboot-admin-server怎么监控微服务,没有更细讲解。现在做案例补充
本文主要针对springboot3进行说明,以yudao-cloud-jdk17为案例,springboot2和3区别不大。
先说引包如下
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server</artifactId>
<version>3.4.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
</dependency>
<!-- Nacos 服务发现 -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
</dependencies>
配置文件
如果不想监控自身,可以增加
需要注意的是,因为有验证,需要被监控的服务增加如下
这样再看界面就可以了
如果你使用看K8S并且使用ingress访问admin,可以参考下,里面有一些关于K8S访问的介绍
https://zhangqinglei.cn/article/k8szmbzingressdhttpszshspringbootzsyz(springboot-adminlz)