我的目标是复制这篇博客文章中的观察结果:https://medium.com/kubernetes-tutorials/monitoring-your-kubernetes-deployments-with-prometheus-5665eda54045
到目前为止,我能够在我的集群中部署示例rpc-app应用程序,下面显示了该应用程序的两个pod正在运行:
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>应用程序公开指标,并通过以下方式进行确认:
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在同一个集群中运行。然而,我在普罗米修斯号上看不到任何rpc_*仪表。
monitoring prometheus-deployment-599bbd9457-pslwf 1/1 Running 0 30m 10.244.0.21 my-server-ip.company.com <none> <none>在promethus GUI中
单击Status ->服务发现,I got
服务发现rpc指标(0 /3个活动目标)
单击状态->目标不显示任何内容(0目标)
点击Status -> Configuration内容可以看到:https://gist.github.com/denissun/14835468be3dbef7bc924032767b9d7f
我对Prometheus/Kubernetes监控是个新手,感谢您的帮助来解决这个问题。
更新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发布于 2021-04-28 08:11:09
您是否创建了Kubernetes Service来公开部署?
kubectl create -f rpc-app-service.yamPrometheus配置监视服务端点,而不是部署|Pod。
看一看Prometheus Operator。它比在集群中运行Prometheus部署稍微复杂一些,但它代表了使用一些优雅的抽象(如PodMonitors和ServiceMonitors )的最先进的Prometheus部署。
https://stackoverflow.com/questions/67289645
复制相似问题