How to forward pod status containerStatuses lastState? #25775
Replies: 1 comment
|
The For exit codes, the usual source is kube-state-metrics, which already converts this part of the Pod API into Prometheus metrics:
Vector can scrape that endpoint and forward the resulting metric events to your existing metrics sink: sources:
kube_state_metrics:
type: prometheus_scrape
endpoints:
- http://kube-state-metrics.kube-system.svc.cluster.local:8080/metrics
scrape_interval_secs: 15
sinks:
your_metrics_sink:
inputs:
- kube_state_metrics
# your existing metrics sink configurationThen query or alert on the exit-code metric, for example: or specifically: This is preferable to attaching References:
The kube-state-metrics |

The
kubernetes_logssource cannot expose arbitrary fields from the Pod.statusobject. Its documented enrichment schema includes selected Pod/container identity and metadata (labels, annotations, IPs, owner, etc.), but notstatus.containerStatuses.For exit codes, the usual source is kube-state-metrics, which already converts this part of the Pod API into Prometheus metrics:
kube_pod_container_status_last_terminated_exitcodekube_pod_container_status_last_terminated_reasonkube_pod_container_status_last_terminated_timestampVector can scrape that endpoint and forward the resulting metric events to your existing metrics sink: