Administering your logging deployment

Deploying Red Hat OpenShift Logging Operator using the web console

You can use the OKD web console to deploy the Red Hat OpenShift Logging Operator.

Prerequisites

Logging is provided as an installable component, with a distinct release cycle from the core OKD. The Red Hat OpenShift Container Platform Life Cycle Policy outlines release compatibility.

Procedure

To deploy the Red Hat OpenShift Logging Operator using the OKD web console:

  1. Install the Red Hat OpenShift Logging Operator:

    1. In the OKD web console, click OperatorsOperatorHub.

    2. Type Logging in the Filter by keyword field.

    3. Choose Red Hat OpenShift Logging from the list of available Operators, and click Install.

    4. Select stable or stable-5.y as the Update Channel.

      The stable channel only provides updates to the most recent release of logging. To continue receiving updates for prior releases, you must change your subscription channel to stable-X where X is the version of logging you have installed.

    5. Ensure that A specific namespace on the cluster is selected under Installation Mode.

    6. Ensure that Operator recommended namespace is openshift-logging under Installed Namespace.

    7. Select Enable Operator recommended cluster monitoring on this Namespace.

    8. Select an option for Update approval.

      • The Automatic option allows Operator Lifecycle Manager (OLM) to automatically update the Operator when a new version is available.

      • The Manual option requires a user with appropriate credentials to approve the Operator update.

    9. Select Enable or Disable for the Console plugin.

    10. Click Install.

  2. Verify that the Red Hat OpenShift Logging Operator is installed by switching to the OperatorsInstalled Operators page.

    1. Ensure that Red Hat OpenShift Logging is listed in the openshift-logging project with a Status of Succeeded.
  3. Create a ClusterLogging instance.

    The form view of the web console does not include all available options. The YAML view is recommended for completing your setup.

    1. In the collection section, select a Collector Implementation.

      As of logging version 5.6 Fluentd is deprecated and is planned to be removed in a future release. Red Hat will provide bug fixes and support for this feature during the current release lifecycle, but this feature will no longer receive enhancements and will be removed. As an alternative to Fluentd, you can use Vector instead.

    2. In the logStore section, select a type.

      As of logging version 5.4.3 the OpenShift Elasticsearch Operator is deprecated and is planned to be removed in a future release. Red Hat will provide bug fixes and support for this feature during the current release lifecycle, but this feature will no longer receive enhancements and will be removed. As an alternative to using the OpenShift Elasticsearch Operator to manage the default log storage, you can use the Loki Operator.

    3. Click Create.

Deploying the Loki Operator using the web console

You can use the OKD web console to install the Loki Operator.

Prerequisites

  • Supported Log Store (AWS S3, Google Cloud Storage, Azure, Swift, Minio, OpenShift Data Foundation)

Procedure

To install the Loki Operator using the OKD web console:

  1. In the OKD web console, click OperatorsOperatorHub.

  2. Type Loki in the Filter by keyword field.

    1. Choose Loki Operator from the list of available Operators, and click Install.
  3. Select stable or stable-5.y as the Update Channel.

    The stable channel only provides updates to the most recent release of logging. To continue receiving updates for prior releases, you must change your subscription channel to stable-X where X is the version of logging you have installed.

  4. Ensure that All namespaces on the cluster is selected under Installation Mode.

  5. Ensure that openshift-operators-redhat is selected under Installed Namespace.

  6. Select Enable Operator recommended cluster monitoring on this Namespace.

    This option sets the openshift.io/cluster-monitoring: "true" label in the Namespace object. You must select this option to ensure that cluster monitoring scrapes the openshift-operators-redhat namespace.

  7. Select an option for Update approval.

    • The Automatic option allows Operator Lifecycle Manager (OLM) to automatically update the Operator when a new version is available.

    • The Manual option requires a user with appropriate credentials to approve the Operator update.

  8. Click Install.

  9. Verify that the LokiOperator installed by switching to the OperatorsInstalled Operators page.

    1. Ensure that LokiOperator is listed with Status as Succeeded in all the projects.
  10. Create a Secret YAML file that uses the access_key_id and access_key_secret fields to specify your credentials and bucketnames, endpoint, and region to define the object storage location. AWS is used in the following example:

    1. apiVersion: v1
    2. kind: Secret
    3. metadata:
    4. name: logging-loki-s3
    5. namespace: openshift-logging
    6. stringData:
    7. access_key_id: AKIAIOSFODNN7EXAMPLE
    8. access_key_secret: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
    9. bucketnames: s3-bucket-name
    10. endpoint: https://s3.eu-central-1.amazonaws.com
    11. region: eu-central-1
  11. Select Create instance under LokiStack on the Details tab. Then select YAML view. Paste in the following template, subsituting values where appropriate.

    1. apiVersion: loki.grafana.com/v1
    2. kind: LokiStack
    3. metadata:
    4. name: logging-loki (1)
    5. namespace: openshift-logging
    6. spec:
    7. size: 1x.small (2)
    8. storage:
    9. schemas:
    10. - version: v12
    11. effectiveDate: '2022-06-01'
    12. secret:
    13. name: logging-loki-s3 (3)
    14. type: s3 (4)
    15. storageClassName: <storage_class_name> (5)
    16. tenants:
    17. mode: openshift-logging
    1Name should be logging-loki.
    2Select your Loki deployment size.
    3Define the secret used for your log storage.
    4Define corresponding storage type.
    5Enter the name of an existing storage class for temporary storage. For best performance, specify a storage class that allocates block storage. Available storage classes for your cluster can be listed using oc get storageclasses.
    1. Apply the configuration:

      1. oc apply -f logging-loki.yaml
  12. Create or edit a ClusterLogging CR:

    1. apiVersion: logging.openshift.io/v1
    2. kind: ClusterLogging
    3. metadata:
    4. name: instance
    5. namespace: openshift-logging
    6. spec:
    7. managementState: Managed
    8. logStore:
    9. type: lokistack
    10. lokistack:
    11. name: logging-loki
    12. collection:
    13. type: vector
    1. Apply the configuration:

      1. oc apply -f cr-lokistack.yaml

Installing from OperatorHub using the CLI

Instead of using the OKD web console, you can install an Operator from OperatorHub by using the CLI. Use the oc command to create or update a Subscription object.

Prerequisites

  • Access to an OKD cluster using an account with cluster-admin permissions.

  • You have installed the OpenShift CLI (oc).

Procedure

  1. View the list of Operators available to the cluster from OperatorHub:

    1. $ oc get packagemanifests -n openshift-marketplace

    Example output

    1. NAME CATALOG AGE
    2. 3scale-operator Red Hat Operators 91m
    3. advanced-cluster-management Red Hat Operators 91m
    4. amq7-cert-manager Red Hat Operators 91m
    5. ...
    6. couchbase-enterprise-certified Certified Operators 91m
    7. crunchy-postgres-operator Certified Operators 91m
    8. mongodb-enterprise Certified Operators 91m
    9. ...
    10. etcd Community Operators 91m
    11. jaeger Community Operators 91m
    12. kubefed Community Operators 91m
    13. ...

    Note the catalog for your desired Operator.

  2. Inspect your desired Operator to verify its supported install modes and available channels:

    1. $ oc describe packagemanifests <operator_name> -n openshift-marketplace
  3. An Operator group, defined by an OperatorGroup object, selects target namespaces in which to generate required RBAC access for all Operators in the same namespace as the Operator group.

    The namespace to which you subscribe the Operator must have an Operator group that matches the install mode of the Operator, either the AllNamespaces or SingleNamespace mode. If the Operator you intend to install uses the AllNamespaces, then the openshift-operators namespace already has an appropriate Operator group in place.

    However, if the Operator uses the SingleNamespace mode and you do not already have an appropriate Operator group in place, you must create one.

    The web console version of this procedure handles the creation of the OperatorGroup and Subscription objects automatically behind the scenes for you when choosing SingleNamespace mode.

    1. Create an OperatorGroup object YAML file, for example operatorgroup.yaml:

      Example OperatorGroup object

      1. apiVersion: operators.coreos.com/v1
      2. kind: OperatorGroup
      3. metadata:
      4. name: <operatorgroup_name>
      5. namespace: <namespace>
      6. spec:
      7. targetNamespaces:
      8. - <namespace>
    2. Create the OperatorGroup object:

      1. $ oc apply -f operatorgroup.yaml
  4. Create a Subscription object YAML file to subscribe a namespace to an Operator, for example sub.yaml:

    Example Subscription object

    1. apiVersion: operators.coreos.com/v1alpha1
    2. kind: Subscription
    3. metadata:
    4. name: <subscription_name>
    5. namespace: openshift-operators (1)
    6. spec:
    7. channel: <channel_name> (2)
    8. name: <operator_name> (3)
    9. source: redhat-operators (4)
    10. sourceNamespace: openshift-marketplace (5)
    11. config:
    12. env: (6)
    13. - name: ARGS
    14. value: "-v=10"
    15. envFrom: (7)
    16. - secretRef:
    17. name: license-secret
    18. volumes: (8)
    19. - name: <volume_name>
    20. configMap:
    21. name: <configmap_name>
    22. volumeMounts: (9)
    23. - mountPath: <directory_name>
    24. name: <volume_name>
    25. tolerations: (10)
    26. - operator: "Exists"
    27. resources: (11)
    28. requests:
    29. memory: "64Mi"
    30. cpu: "250m"
    31. limits:
    32. memory: "128Mi"
    33. cpu: "500m"
    34. nodeSelector: (12)
    35. foo: bar
    1For default AllNamespaces install mode usage, specify the openshift-operators namespace. Alternatively, you can specify a custom global namespace, if you have created one. Otherwise, specify the relevant single namespace for SingleNamespace install mode usage.
    2Name of the channel to subscribe to.
    3Name of the Operator to subscribe to.
    4Name of the catalog source that provides the Operator.
    5Namespace of the catalog source. Use openshift-marketplace for the default OperatorHub catalog sources.
    6The env parameter defines a list of Environment Variables that must exist in all containers in the pod created by OLM.
    7The envFrom parameter defines a list of sources to populate Environment Variables in the container.
    8The volumes parameter defines a list of Volumes that must exist on the pod created by OLM.
    9The volumeMounts parameter defines a list of volume mounts that must exist in all containers in the pod created by OLM. If a volumeMount references a volume that does not exist, OLM fails to deploy the Operator.
    10The tolerations parameter defines a list of Tolerations for the pod created by OLM.
    11The resources parameter defines resource constraints for all the containers in the pod created by OLM.
    12The nodeSelector parameter defines a NodeSelector for the pod created by OLM.
  5. If the cluster is in STS mode, include the following fields in the Subscription object:

    1. kind: Subscription
    2. # ...
    3. spec:
    4. installPlanApproval: Manual (1)
    5. config:
    6. env:
    7. - name: ROLEARN
    8. value: "<role_arn>" (2)
    1Subscriptions with automatic update approvals are not recommended because there might be permission changes to make prior to updating. Subscriptions with manual update approvals ensure that administrators have the opportunity to verify the permissions of the later version and take any necessary steps prior to update.
    2Include the role ARN details.
  6. Create the Subscription object:

    1. $ oc apply -f sub.yaml

    At this point, OLM is now aware of the selected Operator. A cluster service version (CSV) for the Operator should appear in the target namespace, and APIs provided by the Operator should be available for creation.

Deleting Operators from a cluster using the web console

Cluster administrators can delete installed Operators from a selected namespace by using the web console.

Prerequisites

  • You have access to an OKD cluster web console using an account with cluster-admin permissions.

Procedure

  1. Navigate to the OperatorsInstalled Operators page.

  2. Scroll or enter a keyword into the Filter by name field to find the Operator that you want to remove. Then, click on it.

  3. On the right side of the Operator Details page, select Uninstall Operator from the Actions list.

    An Uninstall Operator? dialog box is displayed.

  4. Select Uninstall to remove the Operator, Operator deployments, and pods. Following this action, the Operator stops running and no longer receives updates.

    This action does not remove resources managed by the Operator, including custom resource definitions (CRDs) and custom resources (CRs). Dashboards and navigation items enabled by the web console and off-cluster resources that continue to run might need manual clean up. To remove these after uninstalling the Operator, you might need to manually delete the Operator CRDs.

Deleting Operators from a cluster using the CLI

Cluster administrators can delete installed Operators from a selected namespace by using the CLI.

Prerequisites

  • You have access to an OKD cluster using an account with cluster-admin permissions.

  • The OpenShift CLI (oc) is installed on your workstation.

Procedure

  1. Check the current version of the subscribed Operator (for example, jaeger) in the currentCSV field:

    1. $ oc get subscription jaeger -n openshift-operators -o yaml | grep currentCSV

    Example output

    1. currentCSV: jaeger-operator.v1.8.2
  2. Delete the subscription (for example, jaeger):

    1. $ oc delete subscription jaeger -n openshift-operators

    Example output

    1. subscription.operators.coreos.com "jaeger" deleted
  3. Delete the CSV for the Operator in the target namespace using the currentCSV value from the previous step:

    1. $ oc delete clusterserviceversion jaeger-operator.v1.8.2 -n openshift-operators

    Example output

    1. clusterserviceversion.operators.coreos.com "jaeger-operator.v1.8.2" deleted