Chapter 2. Integrate and use cost management with OpenShift Container Platform on a restricted network


On restricted or disconnected networks without internet access, configure the Operator Lifecycle Manager to manage local integrations and store cost reports locally for manual upload to Red Hat Hybrid Cloud Console.

  1. Create a OpenShift Container Platform integration manually.
  2. Configure the Operator Lifecycle Manager to install and run local integrations.
  3. Configure the costmanagement-metrics-operator to store cost report CSV files locally using a persistent volume claim (PVC).
  4. Download cost reports stored in the PVC to a workstation.
  5. Upload cost reports to Red Hat Hybrid Cloud Console from your workstation.

Create an OpenShift Container Platform integration manually on Red Hat Hybrid Cloud Console for restricted network installations and other scenarios where automatic integration creation is not available.

Prerequisites

Procedure

  1. From Red Hat Hybrid Cloud Console, click Settings Menu Settings icon > Integrations.
  2. Click the Red Hat tab.
  3. Click Add integration, which opens the Add a cloud integration wizard.
  4. In Select your integration type, click Red Hat OpenShift Container Platform.
  5. In Application, click cost management. Then click Next.
  6. Enter a name in Integration name. Then click Next.
  7. In a new tab, access the OpenShift Container Platform web console. Go to Home Overview and copy your Cluster Identifier.
  8. Back in cost management, enter your Cluster Identifier. Then click Next.
  9. Review the details and click Add to create the integration.

Verification

  • In Red Hat Hybrid Cloud Console, navigate to Settings > Integrations > Red Hat.
  • Verify that your new OpenShift Container Platform integration appears in the list with status Active.

Because remote integrations require full Internet connectivity, Operator Lifecycle Manager (OLM) cannot access OpenShift Container Platform clusters that are installed on restricted (disconnected) networks. You must install and configure OLM to run locally.

Prerequisites

  • You installed an OpenShift Container Platform cluster.
  • You have a workstation with unrestricted network access.
  • You logged in to the OpenShift Container Platform web console and have cluster administrator privileges.

Procedure

  1. Complete the following OpenShift Container Platform procedure to create a local mirror of the costmanagement-metrics-operator: Using Operator Lifecycle Manager in disconnected environments.

    Note

    The costmanagement-metrics-operator is in the redhat-operators catalog in the registry.redhat.io/redhat/redhat-operator-index:OCP_VERSION where OCP_VERSION matches the cluster version.

    Prune unwanted objects from the index before you push to the mirrored registry, but do not delete the costmanagement-metrics-operator package.

  2. Log in to the OpenShift Container Platform web console and navigate the Software Catalog page.

    Note

    If you are using OpenShift Container Platform 4.18 or earlier, navigate to the Operator Hub page.

  3. Click Cost Management Metrics Operator.
  4. The Install Operator window opens. Select the costmanagement-metrics-operator namespace that you want to install. If the namespace does not exist, it gets created.
  5. Click Install.

Verification

After a short wait, Cost Management Metrics Operator appears in the Installed Operators tab in Project: all projects or Project: costmanagement-metrics-operator.

Configure the costmanagement-metrics-operator to store cost reports locally on a persistent volume claim for restricted network environments without internet access.

Prerequisites

Procedure

  1. From the OpenShift Container Platform web console, select Operators > Installed Operators > costmanagement-metrics-operator > CostManagementMetricsConfig > Create Instance.
  2. Set a storage amount. If you do not specify an amount, the operator creates a default persistent volume claim (PVC) called costmanagement-metrics-operator-data with 10Gi of storage.

    Note

    To configure the costmanagement-metrics-operator to use a different PVC, edit volume_claim_template in YAML view.

  3. Select YAML view and configure the following settings:

    1. Enter a value in max_reports_to_store to set the maximum number of reports that you want to store.
    2. Enter a value in upload_cycle to set how many minutes you want to pass between each report generation.

          packaging:
            max_reports_to_store: 30
            max_size_MB: 100
          upload:
            upload_cycle: 360
      Important

      The costmanagement-metrics-operator creates one report every 360 minutes by default. The default value of 30 reports and 360 minutes gives you 7.5 days of reports.

      After the maximum number of reports generate, any subsequent reports replace the oldest report in storage. To avoid losing reports, download them from your PVC.

  4. Configure restricted network settings by setting the following values:

    1. Set upload_toggle to false:

          upload:
            upload_cycle: 360
            upload_toggle: false
    2. Set source to empty braces:

          source: {}
    3. Set authentication to empty braces:

          authentication: {}
  5. Click Create.

Verification

  1. Select the CostManagementMetricsConfig that you created.
  2. Click YAML view.
  3. Verify that a report was created by viewing the data in packaging:

        packaging:
          last_successful_packaging_time: `current date and time`
          max_reports_to_store: 30
          max_size_MB: 100
          number_of_reports_stored: 1
          packaged_files:
            - >-
                /tmp/costmanagement-metrics-operator-reports/upload/YYYYMMDDTHHMMSS-cost-mgmt.tar.gz
    Note

    After configuration, costmanagement-metrics-operator generates an initial report. These reports are in packaged_files.

2.4. Download cost reports

If you configured the costmanagement-metrics-operator to run on a restricted network, the reports from the persistent volume claims (PVC) are temporarily stored in a workstation. Copy the reports to an unrestricted network.

The default configuration saves one week of reports. To avoid losing metrics data, download the reports locally and upload them to Red Hat Hybrid Cloud Console weekly.

You can configure any PVC, but by default, most PVCs are ReadWriteOnce. For ReadWriteOnce PVCs, the volume-shell must be attached to the same node as the operator pod.

Prerequisites

  • You have a workstation with unrestricted network access.
  • costmanagement-metrics-operator reports in your PVC.

Procedure

  1. Create the following pod and set claimName to the PVC with the report data:

    kind: Pod
    apiVersion: v1
    metadata:
      name: volume-shell
      namespace: costmanagement-metrics-operator
    spec:
      volumes:
      - name: costmanagement-metrics-operator-reports
        persistentVolumeClaim:
          claimName: costmanagement-metrics-operator-data
      containers:
      - name: volume-shell
        image: busybox
        command: ['sleep', '3600']
        volumeMounts:
        - name: costmanagement-metrics-operator-reports
          mountPath: /tmp/costmanagement-metrics-operator-reports
  2. Run rsync to copy all of the files from the PVC to a local folder:

    $ oc rsync volume-shell:/tmp/costmanagement-metrics-operator-reports/upload local/path/to/save/folder
  3. Run the following command to connect to the pod and delete the contents of the upload folder:

    $ oc rsh volume-shell
    $ rm /tmp/costmanagement-metrics-operator-reports/upload/*
  4. Optional: Run the following command to delete the pod that you used to connect to the PVC:

    $ oc delete -f volume-shell.yaml

Verification

  • Verify that the cost report files were copied to your local folder and have the naming format YYYYMMDDTHHMMSS-cost-mgmt.tar.gz.

Next steps

View your PVC usage.

+ In the OpenShift tab in Red Hat Hybrid Cloud Console, your PVCs with the highest usage automatically populate under Persistent Volume Claims. To view all PVCs, click more at the end of the section.

+ You can filter your PVC data by the following fields: * Persistent volume claim * Cluster * StorageClass

Manually upload your locally stored cost reports from a restricted network to Red Hat Hybrid Cloud Console. The default configuration saves one week of reports. Download the reports locally and upload them to Red Hat Hybrid Cloud Console weekly to avoid losing metrics data.

Note

The service account used to upload data must be added to a user group that has the cost management:settings:write permission. When configuring this in the Red Hat Hybrid Cloud Console, ensure that the group’s assigned role includes the cost-management application and the settings resource type with write operations enabled. This is required to access the Ingress Reports application programming interface (API) for data uploads.

Prerequisites

  • You created a Bearer token.
  • You have costmanagement-metrics-operator reports downloaded locally.
  • You are a Red Hat account user with Organization Administrator entitlements.
  • You have a workstation with unrestricted network access.

Procedure

  • To upload your reports to Red Hat Hybrid Cloud Console, set your client_id and client_secret to your credentials, set FILE_NAME to the report that you want to upload, and enter your Bearer token in $TOKEN:

    $ curl -vvvv -F "file=@$FILE_NAME.tar.gz;type=application/vnd.redhat.hccm.tar+tgz" -H "Authorization: Bearer $TOKEN" https://console.redhat.com/api/ingress/v1/upload

Verification

  1. From cost management, click OpenShift.
  2. On the OpenShift details page, confirm that you have OpenShift usage data for your cluster.
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat Documentation

Legal Notice

Theme

© 2026 Red Hat
Back to top