多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
# kube-state-metrics 介绍 kube-state-metrics is a simple service that listens to the Kubernetes API server and generates metrics about the state of the objects. (See examples in the Metrics section below.) It is not focused on the health of the individual Kubernetes components, but rather on the health of the various objects inside, such as deployments, nodes and pods. The metrics are exported through the Prometheus golang client on the HTTP endpoint /metrics on the listening port (default 8080). They are served either as plaintext or protobuf depending on the Accept header. They are designed to be consumed either by Prometheus itself or by a scraper that is compatible with scraping a Prometheus client endpoint. You can also open /metrics in a browser to see the raw metrics. * CronJob Metrics * DaemonSet Metrics * Deployment Metrics * Job Metrics * LimitRange Metrics * Node Metrics * PersistentVolume Metrics * PersistentVolumeClaim Metrics * Pod Metrics * ReplicaSet Metrics * ReplicationController Metrics * ResourceQuota Metrics * Service Metrics * StatefulSet Metrics * Namespace Metrics * Horizontal Pod Autoscaler Metrics * Endpoint Metrics [kube-state-metricsgithub 项目地址](https://github.com/kubernetes/kube-state-metrics) 查看kube-state配置文件 # tree kube-state-metrics/ kube-state-metrics/ ├── kube-state-metrics-cluster-role-binding.yaml ├── kube-state-metrics-cluster-role.yaml ├── kube-state-metrics-deployment.yaml ├── kube-state-metrics-role-binding.yaml ├── kube-state-metrics-role.yaml ├── kube-state-metrics-service-account.yaml ├── kube-state-metrics-service.yaml └── prometheus-k8s-service-monitor-kube-state-metrics.yaml 0 directories, 8 files 执行创建 kube-state-metrics kubectl apply -f kube-state-metrics/ 检查服务启动状态 [root@app553 ~]# kubectl get pod,svc -n monitoring NAME READY STATUS RESTARTS AGE po/kube-state-metrics-678d94f978-nv4g5 2/2 Running 0 52m po/prometheus-k8s-0 2/2 Running 0 4d po/prometheus-k8s-1 2/2 Running 0 4d po/prometheus-operator-68589bfbfd-pf4tk 1/1 Running 0 4d po/rbd-provisioner-698ddf4568-w7s29 1/1 Running 0 4d 检查kube-state-metrics 在prometheus 启动状态 ![kube-state](https://box.kancloud.cn/6f0b8baf03a349e7c2b7bc3e7492cc51_1472x539.png)