Questo contenuto non è disponibile nella lingua selezionata.

Chapter 2. Installing Red Hat OpenShift GitOps


Red Hat OpenShift GitOps uses Argo CD to manage specific cluster-scoped resources, including cluster Operators, optional Operator Lifecycle Manager (OLM) Operators, and user management.

2.1. Prerequisites

  • You have access to the OpenShift Container Platform web console.
  • You are logged in as a user with the cluster-admin role.
  • You are logged in to the OpenShift Container Platform cluster as an administrator.
  • Your cluster has the Marketplace capability enabled or the Red Hat Operator catalog source configured manually.
Warning

If you have already installed the Community version of the Argo CD Operator, remove the Argo CD Community Operator before you install the Red Hat OpenShift GitOps Operator.

This guide explains how to install the Red Hat OpenShift GitOps Operator to an OpenShift Container Platform cluster and log in to the Argo CD instance.

Important

The latest channel enables installation of the most recent stable version of the Red Hat OpenShift GitOps Operator. Currently, it is the default channel for installing the Red Hat OpenShift GitOps Operator.

To install a specific version of the Red Hat OpenShift GitOps Operator, cluster administrators can use the corresponding gitops-<version> channel. For example, to install the Red Hat OpenShift GitOps Operator version 1.8.x, you can use the gitops-1.8 channel.

2.2. Installing Red Hat OpenShift GitOps Operator in web console

You can install Red Hat OpenShift GitOps Operator from the OperatorHub by using the web console.

Procedure

  1. Open the Administrator perspective of the web console and go to Operators OperatorHub.
  2. Search for OpenShift GitOps, click the Red Hat OpenShift GitOps tile, and then click Install.
  3. On the Install Operator page:

    1. Select an Update channel.
    2. Select a GitOps Version to install.
    3. Choose an Installed Namespace. The default installation namespace is openshift-gitops-operator.

      Note

      For the GitOps version 1.10 and later, the default namespace changed from openshift-operators to openshift-gitops operator.

    4. Select the Enable Operator recommended cluster monitoring on this Namespace checkbox to enable cluster monitoring.

      Note

      You can enable cluster monitoring on any namespace by applying the openshift.io/cluster-monitoring=true label:

      $ oc label namespace <namespace> openshift.io/cluster-monitoring=true

      Example output

      namespace/<namespace> labeled

  4. Click Install to make the GitOps Operator available on the OpenShift Container Platform cluster.

    Red Hat OpenShift GitOps is installed in all namespaces of the cluster.

  5. Verify that the Red Hat OpenShift GitOps Operator is listed in Operators Installed Operators. The Status should resolve to Succeeded.

After the Red Hat OpenShift GitOps Operator is installed, it automatically sets up a ready-to-use Argo CD instance that is available in the openshift-gitops namespace, and an Argo CD icon is displayed in the console toolbar. You can create subsequent Argo CD instances for your applications under your projects.

2.3. Installing Red Hat OpenShift GitOps Operator using CLI

You can install Red Hat OpenShift GitOps Operator from the OperatorHub by using the CLI.

Note

For the GitOps version 1.10 and later, the default namespace changed from openshift-operators to openshift-gitops operator.

Procedure

  1. Create a openshift-gitops-operator namespace:

    $ oc create ns openshift-gitops-operator

    Example output

    namespace/openshift-gitops-operator created

    Note

    You can enable cluster monitoring on openshift-gitops-operator, or any namespace, by applying the openshift.io/cluster-monitoring=true label:

    $ oc label namespace <namespace> openshift.io/cluster-monitoring=true

    Example output

    namespace/<namespace> labeled

  2. Create a OperatorGroup object YAML file, for example, gitops-operator-group.yaml:

    Example OperatorGroup

    apiVersion: operators.coreos.com/v1
    kind: OperatorGroup
    metadata:
      name: openshift-gitops-operator
      namespace: openshift-gitops-operator
    spec:
      upgradeStrategy: Default

  3. Apply the OperatorGroup to the cluster:

    $ oc apply -f gitops-operator-group.yaml

    Example output

    operatorgroup.operators.coreos.com/openshift-gitops-operator created

  4. Create a Subscription object YAML file to subscribe a namespace to the Red Hat OpenShift GitOps Operator, for example, openshift-gitops-sub.yaml:

    Example Subscription

    apiVersion: operators.coreos.com/v1alpha1
    kind: Subscription
    metadata:
      name: openshift-gitops-operator
      namespace: openshift-gitops-operator
    spec:
      channel: latest 1
      installPlanApproval: Automatic
      name: openshift-gitops-operator 2
      source: redhat-operators 3
      sourceNamespace: openshift-marketplace 4

    1
    Specify the channel name from where you want to subscribe the Operator.
    2
    Specify the name of the Operator to subscribe to.
    3
    Specify the name of the CatalogSource that provides the Operator.
    4
    The namespace of the CatalogSource. Use openshift-marketplace for the default OperatorHub CatalogSources.
  5. Apply the Subscription to the cluster:

    $ oc apply -f openshift-gitops-sub.yaml

    Example output

    subscription.operators.coreos.com/openshift-gitops-operator created

  6. After the installation is complete, verify that all the pods in the openshift-gitops namespace are running:

    $ oc get pods -n openshift-gitops

    Example output

    NAME                                                      	  READY   STATUS    RESTARTS   AGE
    cluster-b5798d6f9-zr576                                   	  1/1 	  Running   0          65m
    openshift-gitops-application-controller-0                 	  1/1 	  Running   0          53m
    openshift-gitops-applicationset-controller-6447b8dfdd-5ckgh       1/1 	  Running   0          65m
    openshift-gitops-dex-server-569b498bd9-vf6mr                      1/1     Running   0          65m
    openshift-gitops-redis-74bd8d7d96-49bjf                   	  1/1 	  Running   0          65m
    openshift-gitops-repo-server-c999f75d5-l4rsg              	  1/1 	  Running   0          65m
    openshift-gitops-server-5785f7668b-wj57t                  	  1/1 	  Running   0          53m

  7. Verify that the pods in the openshift-gitops-operator namespace are running:

    $ oc get pods -n openshift-gitops-operator

    Example output

    NAME                                                            READY   STATUS    RESTARTS   AGE
    openshift-gitops-operator-controller-manager-664966d547-vr4vb   2/2     Running   0          65m

2.4. Logging in to the Argo CD instance by using the Argo CD admin account

Red Hat OpenShift GitOps automatically creates a ready-to-use Argo CD instance that is available in the openshift-gitops namespace. Optionally, you can create a new Argo CD instance to manage cluster configurations or deploy applications.

Use the Argo CD admin account to log in to the default ready-to-use Argo CD instance or the newly installed and deployed Argo CD instance.

Prerequisites

  • You have installed the Red Hat OpenShift GitOps Operator on your OpenShift Container Platform cluster.

Procedure

  1. In the Administrator perspective of the web console, navigate to Operators Installed Operators to verify that the Red Hat OpenShift GitOps Operator is installed.
  2. Navigate to the red hat applications menu icon menu OpenShift GitOps Cluster Argo CD. The login page of the Argo CD UI is displayed in a new window.
  3. Optional: To log in with your OpenShift Container Platform credentials, ensure you are a user of the cluster-admins group and then select the LOG IN VIA OPENSHIFT option in the Argo CD user interface.

    Note

    To be a user of the cluster-admins group, use the oc adm groups new cluster-admins <user> command, where <user> is the default cluster role that you can bind to users and groups cluster-wide or locally.

  4. Obtain the password for the Argo CD instance:

    1. Use the navigation panel to go to the Workloads Secrets page.
    2. Use the Project drop-down list and select the namespace where the Argo CD instance is created.
    3. Select the <argo_CD_instance_name>-cluster instance to display the password.
    4. On the Details tab, copy the password under Data admin.password.
  5. Use admin as the Username and the copied password as the Password to log in to the Argo CD UI in the new window.
Note

You cannot create two Argo CD CRs in the same namespace.

2.5. Additional resources

Red Hat logoGithubRedditYoutubeTwitter

Formazione

Prova, acquista e vendi

Community

Informazioni sulla documentazione di Red Hat

Aiutiamo gli utenti Red Hat a innovarsi e raggiungere i propri obiettivi con i nostri prodotti e servizi grazie a contenuti di cui possono fidarsi.

Rendiamo l’open source più inclusivo

Red Hat si impegna a sostituire il linguaggio problematico nel codice, nella documentazione e nelle proprietà web. Per maggiori dettagli, visita ilBlog di Red Hat.

Informazioni su Red Hat

Forniamo soluzioni consolidate che rendono più semplice per le aziende lavorare su piattaforme e ambienti diversi, dal datacenter centrale all'edge della rete.

© 2024 Red Hat, Inc.