Kubernetes Prerequisites
To collect, or scrape, metrics from Kubernetes clusters, the Prometheus collector must be deployed and a listening service properly configured.
To collect Kubernetes metrics, the Prometheus collector is required. A collector must be available for each account in Virtana Platform that includes Kubernetes.
You must install Prometheus with an HTTPS connection and use a CA certificate (self-signed certificates are not supported). You must also provide Cloud Cost Management (CCM) public access to the Prometheus API.
Prometheus can be configured inside or outside of a cluster. It can also use federated or nonfederated services.
See Prometheus documentation for download and configuration instructions.
The kube-state-metrics (KSM) listening service must be available. The KSM service sends metrics about the state of objects in a Kubernetes cluster. Prometheus must be able to scrape from the endpoint '/metrics' on port 8080 by default.
Depending on your CSP and how Kubernetes was installed, the KSM service might be available by default or you might need to install it manually.
If manually installed, you might need to add annotations to each Kubernetes pod to be scraped.
If needed, the annotations to be added are:
prometheus.io/scrape: 'true' prometheus.io/path: '/metrics' prometheus.io/port: '8080' Services or pods from which metrics are to be collected must specify the /scrape: 'true' annotation. The default path and port can be changed.
In the Kubernetes config-map file, there are three entries (_meta_kubernetes_pod_annotation_prometheus_io_<...>) that indicate that information about scraping, metrics path, and port should be read from the pod annotations.
See the kube-state-metrics GitHub site for details about the service.
Related Topics