I have a multi-container pod in my kubernetes deployment:
For every of those containers, there's a container with Prometheus exporter as well.
The question is how can I expose those ports to Prometheus if annotations section supports only one port per pod?
annotations:
prometheus.io/scrape: 'true'
prometheus.io/port: 'xxxx'
but I need something like this:
annotations:
prometheus.io/scrape: 'true'
prometheus.io/port_1: 'xxxx'
prometheus.io/port_2: 'yyyy'
prometheus.io/port_3: 'zzzz'
Maybe there's some other method to scrape all metrics from my multi-container pods? Thanks in advance for any kind of help.
Pods that run multiple containers that need to work together. A Pod can encapsulate an application composed of multiple co-located containers that are tightly coupled and need to share resources.
Prometheus is a high-scalable open-source monitoring framework. It provides out-of-the-box monitoring capabilities for the Kubernetes container orchestration platform. Also, In the observability space, it is gaining huge popularity as it helps with metrics and alerts.
No more than 300000 total containers.
No more than 300000 total containers.
Here's an example job for Prometheus. Put it in your own config.
Next, add:
annotations:
prometheus.io/scrape: 'true'
to your pod metadata.
And on every container, which provides /metrics to prom, create an appropriate port, named metrics
.
That's it. Prometheus would scrape only those ports, and there would be no situation, like when your redis instance would get http requests on its 6379 port.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With