大佬教程收集整理的这篇文章主要介绍了Kubernetes 中的示例容器化应用程序无法在 Prometheus 中显示为用于抓取指标的目标,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我的目标是重现这篇博文中的观察结果:https://medium.com/kubernetes-tutorials/monitoring-your-kubernetes-deployments-with-prometheus-5665eda54045@H_403_1@
到目前为止,我已经能够在我的集群中部署示例 rpc-app 应用程序,以下显示此应用程序的两个 Pod 正在运行:@H_403_1@
nameSPACE name READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READInesS GATES
default rpc-app-deployment-64f456b65-5m7j5 1/1 Running 0 3h23m 10.244.0.15 my-server-ip.company.com <none> <none>
default rpc-app-deployment-64f456b65-9mnfd 1/1 Running 0 3h23m 10.244.0.14 my-server-ip.company.com <none> <none>
应用公开指标并通过以下方式确认:@H_403_1@
root@xxxxx:/u01/app/k8s # curl 10.244.0.14:8081/metrics
# HelP go_gc_duration_seconds A sumMary of the GC invocation durations.
# TYPE go_gc_duration_seconds sumMary
go_gc_duration_seconds{quantile="0"} 0
go_gc_duration_seconds{quantile="0.25"} 0
...
rpc_durations_seconds{service="uniform",quantile="0.5"} 0.0001021102787270781
rpc_durations_seconds{service="uniform",quantile="0.9"} 0.00018233200374804932
rpc_durations_seconds{service="uniform",quantile="0.99"} 0.00019828258205623097
rpc_durations_seconds_sum{service="uniform"} 6.817882693745326
rpc_durations_seconds_count{service="uniform"} 68279
我的 prometheus pod 在同一个集群中运行。但是我无法在 prometheus 中看到任何 rpc_* 计量表。@H_403_1@
@H_252_5@monitoring prometheus-deployment-599bbd9457-pslwf 1/1 Running 0 30m 10.244.0.21 my-server-ip.company.com <none> <none>
在普罗米修斯 GUI 中@H_403_1@
点击状态 -> 服务发现,我得到了@H_403_1@
服务发现 rpc-metrics(0 / 3 个活动目标)@H_403_1@
单击状态 -> 目标不显示任何内容(0 个目标)@H_403_1@
点击状态 -> 配置 内容可以看成:https://gist.github.com/denissun/14835468be3dbef7bc924032767b9d7f@H_403_1@
我对 Prometheus/Kubernetes 监控非常陌生,感谢您帮助解决此问题。@H_403_1@
更新 1 - 我创建了服务@H_403_1@
`
# cat rpc-app-service.yaml
APIVersion: v1
kind: service
Metadata:
name: rpc-app-service
labels:
app: rpc-app
spec:
ports:
- name: web
port: 8081
targetPort: 8081
protocol: TCP
nodePort: 32325
SELEctor:
app: rpc-app
type: NodePort
# kubectl get service rpc-app-service
name TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
rpc-app-service NodePort 10.110.204.119 <none> 8081:32325/TCP 9h
您是否创建了 Kubernetes 服务来公开部署?
kubectl create -f rpc-app-service.yam
Prometheus 配置监视的是服务端点,而不是部署|Pod。
看看Prometheus Operator。它比在集群中运行 Prometheus 部署稍微复杂一些,但它代表了 Prometheus 的最先进部署,具有一些优雅的抽象,例如 PodMonitors
和 serviceMonitors
。
以上是大佬教程为你收集整理的Kubernetes 中的示例容器化应用程序无法在 Prometheus 中显示为用于抓取指标的目标全部内容,希望文章能够帮你解决Kubernetes 中的示例容器化应用程序无法在 Prometheus 中显示为用于抓取指标的目标所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。