Install the cost management operator with the OpenShift web console

Install the Cost Management Metrics Operator from the OpenShift Container Platform web console so you can import OpenShift usage data into cost management.

Before you begin

  • You have an OpenShift Container Platform cluster.
  • You are logged in to the OpenShift Container Platform web console with an account that has cluster administrator privileges.
  • You can access the Red Hat Hybrid Cloud Console with an account that has access to the cost management service. See Limit access to cost management resources for more information.

Procedure

  1. 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.

  2. Enter Cost Management in the seach box and then select Cost Managment Metrics Operator. The Cost Management Metrics Operator install page opens.
  3. Click Install. The Install Operator page opens.
  4. Click Install at the bottom of the Install Operator page.
  5. Click Installed Operators in the left-hand navigation. A page with a list of installed operators opens.
  6. Click Cost Management Metrics Operator.
  7. Click Create CostManagementMetricsConfig. The configuration YAML file opens.
  8. Scroll to the bottom of the YAML file and change create_source: false to create_source: true. When create_source is set to true, an OpenShift integration is created.
    Note

    If you previously created an OpenShift integration in the Red Hat Hybrid Cloud Console, leave the value of create_source as false.

  9. Change name:'' to the name of your integration, for example:

    name: my-openshift-cost-source

    If you do not provide a name, the operator name defaults to the cluster ID.

  10. Click Create.

Results

  • From the OpenShift Container Platform web console, navigate to Operators > Installed Operators.
  • Verify that Cost Management Metrics Operator appears in the list with status Succeeded.
  • If you set create_source to true, verify that the integration appears in Red Hat Hybrid Cloud Console under Settings > Integrations > Red Hat.

What to do next

Configure service account authentication for the cost management metrics operator

If you manually configured the cost management metrics operator to use basic authentication, you must configure service account authentication. Basic authentication is no longer supported.

Before you begin

  • You are logged into the OpenShift Container Platform web console and have cluster administrator privileges.
  • The Cost Management Metrics Operator is in the Installed Operators tab.

Procedure

  1. Create a service account and get your client ID and client secret:
    1. From Red Hat Hybrid Cloud Console, click Settings iconSettings.
    2. Click Identity & Access Management.
    3. Click the tab Service Accounts.
    4. Click Create service account.
    5. Enter a name and description.

      The name must start with a letter and end with either a letter or a number. Use only alphanumeric characters and hyphens.

    6. Click Create.
    7. Copy the client ID and client secret and store them in a safe location.

      The secret will not be shown again after you close the window.

    8. Select the checkbox I have copied the client ID and secret and then click Close. The account that you created is added to the list.
  2. Associate the new service account with a group:
    1. Click the tab User Access and then click Groups.
    2. Find your desired group in the list and click its name.
    3. In the window that opens, click the tab Service Accounts.
    4. Click Add Service account.
    5. Select the service account that you made in the previous section, or whichever service account that you want to associate with the group.
    6. Click Add to group.

      Your service account will now inherit permissions associated with the roles in your group. To create an integration, the service account that you created for the operator needs the Cloud Administrator role.

  3. Create the secret key/value pair for service account authentication:
    1. In the OpenShift Container Platform web console, click the tab Workloads and then click Secrets.
    2. In the Secrets window, click the Create drop-down and then select Key/value secret. You will make two keys: one for your Client ID and one for your Client Secret.
    3. Enter the following information in the Create key/value secret window:
      • In the Secret Name box, enter service-account-auth-secret.
      • In the Key box, enter client_id.
      • In the Value box for the first key client_id, upload the value for your authorized Red Hat Hybrid Cloud Console user account or paste it into the text box. This is the client ID that you saved when you made your service account.
    4. Click Add Key/Value to add the second key/value pair for your client secret.
    5. In the Key box, enter client_secret:
    6. In the Value box for the second key client_secret, upload the Value for your authorized Red Hat Hybrid Cloud Console user account or paste it into the text box.
    7. After you verify that the key/value details for the secret are correct, click Create to complete the creation of your service account authorization secret.
    8. Copy the name of your secret. You will use it in the following section.
  4. Modify the YAML file:
    1. Click the Operators tab and then click Installed Operators.
    2. Find the Cost Management Metrics Operator and click its name.
    3. Click the tab Cost Management Metrics Config and then click the configuration file in Name. The default name is costmanagementmetricscfg-sample.
    4. Click the tab YAML to open the file.
    5. Locate the following lines in the YAML file:
       authentication:
         type: token
    6. Change type: token to type: service-account.
    7. Insert a new line for secret_name. Enter the secret that you copied in the previous section, for example:
       authentication:
         secret_name: service-account-auth-secret #Change this line to match your secret name.
         type: service-account
    8. Click Save.

Results

  • Navigate to Operators > Installed Operators > Cost Management Metrics Operator.
  • Click the CostManagementMetricsConfig tab and select your configuration.
  • Click YAML and verify that authentication shows type: service-account and your secret name.