Clusters

Register OpenShift cluster with Red Hat Marketplace

To install operators and container images from Red Hat Marketplace to your OpenShift cluster, first register the OpenShift cluster on Red Hat Marketplace.

Prerequisites

  • Add Cluster Admin role to your Red Hat Marketplace user profile.
  • Install OpenShift Container Platform, major version 4 with any available supported minor version or Red Hat CodeReady Containers.
  • Install the version of the OpenShift Command-line Interface (CLI), commonly known as oc, that matches your version of OpenShift.
  • Install the jq package.
  • Login to your OpenShift cluster as a cluster admin.

About this task

To register a cluster, Red Hat Marketplace provides commands to install the Red Hat Marketplace Operator and update your global cluster pull secret. To learn more about the Operator, refer to About Red Hat Marketplace Operator.

Note: When the command updates your global cluster pull secret, you may experience temporary interruptions to applications and services on the cluster.

Procedure

  1. On the main menu, click Workspace, click Clusters, and then click Add cluster.

  2. To create a pull secret, do the following:

    1. Optional - A default name shows on the Pull secret name box. To rename, on the Pull secret name box, enter a new name.
    2. Click Generate Secret.
  3. To create a namespace, copy the Create namespace command, paste it on the command line, and run the command.

  4. To create the operator subscription, copy the Create Red Hat Marketplace Subscription command, paste it on the command line, and run the command.

    • By default, the command installs the operator subscription with automatic updates. To change the subscription to manual updates, copy the following command, paste it on the command line, and run the command.
      oc apply -f "https://sandbox.marketplace.redhat.com/provisioning/v1/rhm-operator/rhm-operator-subscription?approvalStrategy=Manual"
      Note: To manually approve updates, go to your OpenShift Container Platform web console to approve the installation.
  5. To create the Kubernetes secret, copy the Create Red Hat Marketplace Kubernetes Secret command, paste it on the command line, and run the command.

  6. To create the marketplace secret, copy the Add the Red Hat Marketplace pull secret command, paste it on the command line, and run the command.

Result

You connected your cluster to Red Hat Marketplace. Your cluster is ready to be a target cluster for installing and managing software purchases from Red Hat Marketplace. Users associated to your Red Hat Marketplace account can install operators on to the registered cluster.

Next steps

  • To view your cluster, on the Add Cluster page, click View Clusters tile.
  • To find your cluster name, refer to Find cluster name

About cluster name

Red Hat Marketplace associates a unique ID to each registered cluster. The marketplace refers to the unique ID as the cluster name.


Find cluster name

Prerequisites

  • Login to your OpenShift cluster as a cluster admin

Procedure

  • To find your cluster name, copy the following command, paste it on the command line, and run the command.
oc get clusterversion -o jsonpath='{.items[].spec.clusterID}{"\n"}'

Result

The cluster name shows on the command line.

Related topics


Edit cluster name

Prerequisites

Procedure

  1. On the main menu, click Workspace, click Clusters.
  2. On the row of your cluster, click the Menu options button (three dots), and then click View details. The Cluster details page shows.
  3. To edit cluster name, click Edit, on the Cluster name box, enter a new name, and then click Update.

Result

You edited the cluster name.


Register OpenShift cluster on Red Hat CodeReady Containers

Users can try operators locally with Red Hat CodeReady Containers. Red Hat Marketplace recommends local clusters for tasks with minimal performance requirements. To try all product features and functions, Red Hat Marketplace recommends installing operators and container images on remote OpenShift clusters, instead of clusters on local CodeReady Containers.

Prerequisites

  • Set up an OpenShift cluster on your local machine
  • Start your CodeReady Containers virtual machine
  • Register your local cluster with Red Hat Marketplace

About this task

On Red Hat Marketplace, users register local clusters similarly to remote clusters. However, for local clusters, to prepare it for operators, there is an additional procedure. Run the following commands after you register your cluster on Red Hat Marketplace.

Procedure

  1. To get the configuration information, run the following command, and then copy and paste the output to use later:
    oc get secret pull-secret -n openshift-config --output="jsonpath={.data.\.dockerconfigjson}" | base64 --decode
  2. To get the Node Name, run the following command, and then copy and paste the output to use later:
    oc get node
  3. To navigate to the node sh-4.2#, run the following command. Ensure you replace <nodename> with the Node Name you copied in step 2.
    oc debug node/<nodename>
  4. When the node shows, to navigate to the pod sh-4.4#, run the following command:
    chroot /host
  5. Navigate to the following file: /var/lib/kubelet/config.json.
    cd /var/lib/kubelet/
  6. To debug the node, open the config.json file and replace the content in the file with the output you copied on step 1.
    vi config.json
    gg
    dG
    i
    <paste output from step 1>
    :wq
  7. To exit the node, run the following command:
    exit
  8. Run the exit command again until the the following message shows:
    • Removing debug pod ...
  9. Stop your CodeReady Containers virtual machine, and then start it again.
    crc stop
    crc start

Result

Your local cluster is configured for Red Hat Marketplace.

Next Steps

Install an Operator to your local cluster.


Get pull secret

Use the pull secret to update your global cluster pull secret.

Procedure

  1. On the main menu, click your user name, click My Account, click Pull secrets, and then click Create pull secret.
  2. On the Pull secret name box, enter a unique name for your pull secret.
  3. To get your pull secret, on the Your pull secret box, click the Copy button (copy icon).
  4. Click Save.

Result

You copied your pull secret.

Related topics


Delete pull secret

Prerequisites

About this task

Delete a pull secret when your cluster no longer needs to access image registries or when you rotate your pull secrets.

Note: delete pull secret locks access to image registries. Only delete the secret when you no longer need to access the image registry or when you replace a secret with a new secret.

Procedure

  1. On the main menu, click your user name, click My Account, and then click Pull secrets.
  2. On the row of the pull secret, click the Menu Options button (dots icon), and then click Delete.
  3. To delete the pull secret, click Delete.

Result

You deleted the pull secret.


Unregister OpenShift cluster

Prerequisites

  • Associate the Cluster Admin role to your Red Hat Marketplace user profile
  • Login to your OpenShift cluster as a cluster admin

Procedure

  1. On the main menu, click Workspace, and then click Clusters.
  2. On the row of the registered cluster, click the Menu Options button (dots icon), and then click Unregister.
  3. To unregister your cluster, copy the following command, paste it on the command line, and run the command:
    oc delete subscription redhat-marketplace-operator -n openshift-redhat-marketplace
    oc delete MarketplaceConfig marketplaceconfig -n openshift-redhat-marketplace
    oc get csv -n openshift-redhat-marketplace --no-headers | awk '/redhat-marketplace-operator/{print $1}' | xargs oc delete -n openshift-redhat-marketplace csv
  4. Click Confirm.

Result

On the Clusters page, the status changes to To be unregistered. When Red Hat Marketplace confirms communication stopped between your cluster and Red Hat Marketplace, the cluster no longer shows on the Clusters page.


Remove offline cluster from list

Prerequisites

  • Login to Red Hat Marketplace as a cluster admin user

Procedure

  1. On the main menu, click Workspace, and then click Clusters.
  2. On the row of the offline cluster, click the Menu Options button (dots icon), and then click Remove.
  3. To remove the offline cluster from the list, click Remove.

Result

On the Clusters page, a success message shows and the cluster is removed from the list.


Cluster status descriptions

The following table shows descriptions of cluster status:

StatusDescriptionNext steps
ConnectedYou registered your cluster with the marketplaceInstall product operators or unregister cluster
OfflineYou unregistered your cluster from the marketplace.Remove offline cluster from list
Operator not installedYou named the cluster but have not installed Red Hat Marketplace Operator.On the row of the cluster, click Menu options (dots icon), click Register, and then complete the steps that show on the window.
To be unregisteredYou unregistered your cluster from the marketplace.After 1 hour, the cluster status shows as Offline.

Open OpenShift Container Platform web console

Prerequisites

  • Register your OpenShift cluster with Red Hat Marketplace

Procedure

  1. On the main menu, click Workspace, and then click Clusters.
  2. On the row of the cluster, click the Menu Options button (dots icon), and then click Cluster Console.

Result

Your OpenShift console opens in a new tab on your web browser.