Configure Prometheus for Metrics Storage¶
Overview
The prometheus platform application provides metric storage and query
capabilities for the observability stack. It collects metrics from endpoints
exposed by other applications, stores them in a time-series database (TSDB),
and makes them available for PromQL queries and Aodh alarms.
For more information about the observability stack, see Observability Overview.
The prometheus application is an optional platform application based on the
kube-prometheus-stack Helm chart. Its resources are deployed in the
monitoring namespace.
The prometheus application includes the following components:
A Prometheus Operator that discovers metrics endpoints through
ServiceMonitorresources created by other applications and configures the Prometheus server to collect metrics from those endpoints.A Prometheus server that collects and stores metrics in a time-series database (TSDB).
A newly applied prometheus application does not collect any metrics by
default. All built-in scrape targets provided by the
kube-prometheus-stack Helm chart are disabled, and Grafana and
Alertmanager are not deployed.
The following table lists the built-in components that are disabled by default and what their absence means for the deployed application:
Built-in component |
Default state |
What its absence means |
|---|---|---|
|
Disabled |
No host metrics — no CPU, memory, filesystem, or network series for the nodes themselves. |
|
Disabled |
No Kubernetes object state metrics — nothing about pods, deployments, DaemonSets, or nodes as objects. |
|
Disabled |
No kubelet metrics and no cAdvisor container metrics. |
|
Disabled |
No Kubernetes API server metrics. |
|
Disabled |
No controller-manager metrics. |
|
Disabled |
No scheduler metrics. |
|
Disabled |
No etcd metrics. |
|
Disabled |
No kube-proxy metrics. |
|
Disabled |
No cluster DNS metrics. |
|
Disabled |
No dashboard ships. The only graphical interface is the Prometheus server’s own web UI, reached by port forwarding (see Access the Prometheus Web UI). |
|
Disabled |
No alerting mechanism ships — no Alertmanager, no notification routing, no silences, and no Prometheus alerting rules. |
The Prometheus server collects metrics only from targets exposed through
ServiceMonitor resources created by other applications. For example, when
the StarlingX OpenStack application is applied, it deploys Ceilometer
ServiceMonitor resources that are used for service discovery by
the Prometheus server.
Within the cluster, the Prometheus server is reachable at
kube-prometheus-stack-prometheus.monitoring.svc.cluster.local:9090.
Apply the Prometheus Application¶
By default, the prometheus application is uploaded but not applied on a
newly installed system. Apply prometheus before applying stx-openstack
if your deployment requires telemetry metric collection, metric-based alarms,
or PromQL queries. If stx-openstack is applied first, telemetry
monitoring does not function correctly even though the application reports a
successful deployment. To recover, apply prometheus and then re-apply
stx-openstack.
For information on configuring Ceilometer for telemetry data collection, see Configure Ceilometer for Telemetry Data Collection.
The application can be configured using the
system application-* and system helm-override-* commands. When working
with overrides, use the following values:
Application name:
prometheusHelm chart:
kube-prometheus-stackNamespace:
monitoring
Before the application is applied, several validation checks are performed:
Bootstrap validation prevents automatic application deployment while platform bootstrap is still in progress.
StorageClass availability validation ensures that the configured Kubernetes
StorageClassexists in the cluster. For more information, see Configure Storage for the Prometheus Application.StorageClass immutability validation prevents changing the configured
StorageClassafter the application has been applied.
The system rejects the apply operation and returns an appropriate error message if any of these validations fail.
Procedure
Verify that the
prometheusapplication is present and in theuploadedstate:system application-listApply the application:
system application-apply prometheus
Confirm the application is running:
system application-show prometheus # Wait until the status is applied kubectl -n monitoring get pods # Verify that the Prometheus components are running
Configure Storage for the Prometheus Application¶
The prometheus application stores collected metrics in a Prometheus
time-series database (TSDB). The TSDB uses a Kubernetes PVC for persistent
storage. You select the storage backend through a Kubernetes StorageClass.
The application can use any storage backend as long as the associated
Kubernetes StorageClass is available in the cluster.
The following storage configurations were tested with StarlingX:
Ceph RBD (
generalstorage class)NetApp NAS/NFS
NetApp SAN iSCSI
NetApp SAN FC
This list reflects the storage backends that were tested. Backends not listed
may also be supported, provided they have a working StorageClass.
Review the default values in the table below before applying the application.
You must configure the StorageClass before applying the application; it
cannot be changed afterwards. The PVC size should also be set before the first
apply, because a later override does not resize an already-bound claim unless
the StorageClass permits volume expansion. To change the StorageClass,
you must remove and reapply the application, which permanently deletes the PVC
and all stored metric data (see Remove the Prometheus Application).
The Prometheus server retains metrics based on both a time limit and a storage size limit. Metrics are removed when the first of these limits is reached. On busy systems with high metric volumes, the storage size limit may be reached before 15 days, resulting in a shorter retention period. To retain metrics for a longer period, configure a larger PVC size before deploying the Prometheus application.
Setting |
Default Value |
Description |
|---|---|---|
PVC size [1] |
|
Specifies the storage capacity available for Prometheus TSDB metrics. |
StorageClass [1] |
|
Identifies the Kubernetes storage class that provisions the PVC. |
Time retention |
|
Removes metrics older than 15 days. |
Size retention |
|
Limits TSDB storage to approximately 90% of the default 20Gi PVC size. |
|
|
Compresses the write-ahead log (WAL) to reduce disk usage with minimal CPU overhead. |
|
|
Disables the Prometheus administrative API. As a result, you cannot delete series data or create TSDB snapshots through the API. |
Prometheus server replicas |
|
In multi-controller configurations, Prometheus
deploys two replicas with a required anti-affinity
rule, ensuring that each replica runs on a different
controller. Each replica gets its own PVC of the
configured size; they share the |
Footnotes
Procedure
List the StorageClasses available in the cluster.
~(keystone_admin)$ kubectl get storageclass
Set the StorageClass to use.
~(keystone_admin)$ system helm-override-update prometheus kube-prometheus-stack monitoring \ --set prometheus.prometheusSpec.storageSpec.volumeClaimTemplate.spec.storageClassName=<class>
Apply the application.
~(keystone_admin)$ system application-apply prometheus
Access the Prometheus Web UI¶
The Prometheus web UI is not accessible directly from outside the Kubernetes cluster. External access through Ingress with TLS is not provided in this release. To access the UI, create a temporary port-forwarding session from your workstation to the Prometheus service.
Procedure
Forward a local port to the Prometheus service:
~(keystone_admin)$ kubectl -n monitoring port-forward svc/kube-prometheus-stack-prometheus 9090:9090
Results
While the port-forward session is running, access the Prometheus web UI at:
http://localhost:9090.
The Status > Targets page displays the targets currently being scraped by the Prometheus server and serves as the authoritative source for scrape status information.
The Graph page allows you to enter and test PromQL expressions and verify metric data collected by Prometheus. You can use the page to validate queries before using them in metric-based Aodh alarms or by external applications that consume Prometheus metrics.
Apply Prometheus in a Distributed Cloud¶
In a Distributed Cloud configuration, you must apply the prometheus application on
the Central Cloud before applying it on any subcloud. The Central Cloud
application makes the required application images available to the subclouds.
Each subcloud instance is independent. It has its own Prometheus server, TSDB, PVC, and retention window. Instances do not federate, replicate, or share data. A query against one subcloud returns only that subcloud’s metrics. Removing the application on one subcloud has no effect on any other.
To apply the prometheus application in a Distributed Cloud configuration:
Procedure
Verify that the
prometheusapplication is in theuploadedstate on the Central Cloud and on each subcloud. The Distributed Cloud installation uploads the application automatically.system application-listOn the Central Cloud, apply the
prometheusapplication.system application-apply prometheus system application-show prometheus
Wait until the status changes to
appliedbefore proceeding to the next system. This step populates the registry with the application images required by the subclouds.On each subcloud that requires local metric collection and storage, apply the
prometheusapplication.system application-apply prometheus system application-show prometheus
Wait until the application status changes to
applied. Note that this step succeeds only after theprometheusapplication has been successfully applied on the Central Cloud.
Remove the Prometheus Application¶
Removing the prometheus application permanently deletes the PVC, the
monitoring namespace, and all stored metric data. The system does
not create a backup before removal. In addition, the TSDB snapshot API
is not available because enableAdminAPI is disabled by default.
Prerequisites
If you need to retain metric data, extract the required information
through the PromQL query API before removing the prometheus application.
Procedure
To remove the application:
system application-remove --force prometheus
Note
The --force option is required to remove the application. This
requirement ensures that the removal is intentional, because removing
the application also deletes the Prometheus Operator, the PVC, and
all stored metric data.
When you re-apply the application after removal, it creates a new, empty TSDB on a new PVC.
Prometheus Application: Common Issues and Resolutions¶
The following table lists common issues and recommended actions for the
prometheus platform application. Rows marked as by-design require no
corrective action.
Symptom |
Check |
Resolution |
|---|---|---|
system application-apply prometheus is rejected immediately, naming storage. |
Check whether any StorageClass exists:
|
Configure a storage backend that provides a StorageClass, then apply again (see Configure Storage for the Prometheus Application). |
The apply is rejected and the message names a StorageClass that does not exist. |
Compare the class named in the override against the classes that exist:
|
The rejection message lists the available classes and prints the corrective system helm-override-update command. Run it with a class from that list, then apply. |
The Prometheus web UI cannot be reached from a browser. |
Check that the port-forward command is running and that the local port is not in use. |
There is no Ingress and the Service is a ClusterIP. Start a port-forward
and access the UI at |
The Prometheus server has only Ceilometer scrape targets and no host or Kubernetes platform metrics are present. |
Check which ServiceMonitor resources are registered:
This application scrapes only the targets that other applications
register through ServiceMonitor resources. It does not scrape host or
Kubernetes platform metrics. The |
This is by design. No action is required. |
There is no dashboard and no way to define an alerting rule. |
Grafana and Alertmanager are both disabled by design. The Prometheus web UI is the only graphical interface deployed. |
Use the Graph page in the web UI to run PromQL queries (see Access the Prometheus Web UI). |
An override that changes the StorageClass is rejected on an applied application. |
Confirm the application is applied:
|
The StorageClass can only be changed while the application is
|
system application-remove prometheus is refused. |
Check whether the command was issued without |
Repeat the command with |
On a subcloud, system application-apply prometheus fails to pull images. |
Check whether the application has been applied on the Central Cloud:
|
Apply it on the Central Cloud first. That apply populates the central registry (see Apply Prometheus in a Distributed Cloud). |
The Prometheus server has no Ceilometer targets even though both
|
Check whether the Ceilometer ServiceMonitors exist:
If they are missing, StarlingX OpenStack was applied before |
Apply For information on configuring Ceilometer for telemetry data collection, see Configure Ceilometer for Telemetry Data Collection. |