In order for prometheus to sucessfully scrape pods in a cf-for-k8s cluster,
it currently needs the following:
Be deployed in namespace that has the label “istio-injection=enabled”.
This injects istio sidecars onto prometheus’s pods. The recommended namespace is cf-system.
Have a network policy in place that allows prometheus to scrape your app’s pod.
Have the necessary certs available in prometheus’s istio sidecar.
Because of the complexity of these requirements, we recommend using
cf-k8s-prometheus.
To set up port forwarding, run the following commands:
Reach out to us in the Cloud Foundry Slack channel #logging-and-metrics.
To request a response during Mountain Time business hours, tag your message with @interrupt.
cf-for-k8s-metric-examples
Examples for Metrics in cf-for-k8s
Setting up metrics in cf-for-k8s involves the following steps:
manifest.yml, define the appropriate Prometheus annotationsThis repo provides examples of applications and the appropriate annotations.
Deploying an app with metrics
Requirements
Deploying the app
Change into your app’s root directory and
cf pushExample for
golangusing cf CLI:cd go-app-with-metricscf pushVerifying it emits metrics
By defining the Prometheus annotations in the
manifest.yml, Prometheus will automatically pick up your app’s metrics endpoint.If you have
kubectlaccess on your cluster, you can verify that your app is emitting metrics by port-forwarding:Deploying Prometheus Server
In order for prometheus to sucessfully scrape pods in a cf-for-k8s cluster, it currently needs the following:
cf-system.Because of the complexity of these requirements, we recommend using cf-k8s-prometheus.
To set up port forwarding, run the following commands:
After setting up the port forwarding, access the Prometheus web UI by going to localhost:9090
Default Metrics Availability
Metrics should be included for all Prometheus nodes, the API node, and any pods annotated with Prometheus scrape configurations:
Have a question or feedback, reach out to us
Reach out to us in the Cloud Foundry Slack channel #logging-and-metrics. To request a response during Mountain Time business hours, tag your message with @interrupt.