This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.Este conteúdo não está disponível no idioma selecionado.
Chapter 13. Using metering with OpenShift Serverless
As a cluster administrator, you can use metering to analyze what is happening in your OpenShift Serverless cluster.
For more information about metering on OpenShift Container Platform, see About metering.
13.1. Installing metering Copiar o linkLink copiado para a área de transferência!
For information about installing metering on OpenShift Container Platform, see Installing Metering.
13.2. Datasources for Knative Serving metering Copiar o linkLink copiado para a área de transferência!
The following ReportDataSources
are examples of how Knative Serving can be used with OpenShift Container Platform metering.
13.2.1. Datasource for CPU usage in Knative Serving Copiar o linkLink copiado para a área de transferência!
This datasource provides the accumulated CPU seconds used per Knative service over the report time period.
Example YAML file
13.2.2. Datasource for memory usage in Knative Serving Copiar o linkLink copiado para a área de transferência!
This datasource provides the average memory consumption per Knative service over the report time period.
Example YAML file
13.2.3. Applying data sources for Knative Serving metering Copiar o linkLink copiado para a área de transferência!
Procedure
Apply the
ReportDataSources
resource as a YAML file:oc apply -f <datasource_name>.yaml
$ oc apply -f <datasource_name>.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example command
oc apply -f knative-service-memory-usage.yaml
$ oc apply -f knative-service-memory-usage.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
13.3. Queries for Knative Serving metering Copiar o linkLink copiado para a área de transferência!
The following ReportQuery
resources reference the example DataSources
provided.
13.3.1. Query for CPU usage in Knative Serving Copiar o linkLink copiado para a área de transferência!
Example YAML file
13.3.2. Query for memory usage in Knative Serving Copiar o linkLink copiado para a área de transferência!
Example YAML file
13.3.3. Applying queries for Knative Serving metering Copiar o linkLink copiado para a área de transferência!
Apply the query as a YAML file:
oc apply -f <query_name>.yaml
$ oc apply -f <query_name>.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example command
oc apply -f knative-service-memory-usage.yaml
$ oc apply -f knative-service-memory-usage.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
13.4. Metering reports for Knative Serving Copiar o linkLink copiado para a área de transferência!
You can run metering reports against Knative Serving by creating Report
resources. Before you run a report, you must modify the input parameter within the Report
resource to specify the start and end dates of the reporting period.
Example YAML file
13.4.1. Running a metering report Copiar o linkLink copiado para a área de transferência!
Run the report by applying it as a YAML file:
oc apply -f <report_name>.yaml
$ oc apply -f <report_name>.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow You can then check the report by entering the following command:
oc get report
$ oc get report
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
NAME QUERY SCHEDULE RUNNING FAILED LAST REPORT TIME AGE knative-service-cpu-usage knative-service-cpu-usage Finished 2019-06-30T23:59:59Z 10h
NAME QUERY SCHEDULE RUNNING FAILED LAST REPORT TIME AGE knative-service-cpu-usage knative-service-cpu-usage Finished 2019-06-30T23:59:59Z 10h
Copy to Clipboard Copied! Toggle word wrap Toggle overflow