【java】 prometheus监控告警

(1)场景:使用prometheus监控k8s集群的运行状态,并做到监控告警。

(2)pom:  git地址

        <dependency>
            <groupId>io.kubernetes</groupId>
            <artifactId>client-java</artifactId>
            <version>5.0.0</version>
            <scope>compile</scope>
        </dependency>

(3)实现思路

通过调用kubernetes api 实现资源文件的创建,进而达到目的。(说的比较笼统,细节我存在一些疑问,大佬可以替我补充补充)

(4)用的主要api,其实就是调用kube-apiserver的接口

    @Autowired
    private ApiClient apiClient;

    @Autowired
    private CoreV1Api coreV1Api;

    @Autowired
    private CustomObjectsApi customObjectsApi;
customObjectsApi + apiClient 是操作PrometheusRule资源对象、coreV1Api是操作AlertManager资源对象。

说到这里可能大家根本不知道我在讲啥,下面我说下prometheus的结构。

猜你喜欢

转载自blog.csdn.net/qq_25221835/article/details/102949760