Installing OpenShift Logging

    The process for deploying OpenShift Logging to OKD involves:

    You can use the OKD web console to install the OpenShift Elasticsearch and Red Hat OpenShift Logging Operators.

    Prerequisites

    • Ensure that you have the necessary persistent storage for Elasticsearch. Note that each Elasticsearch node requires its own storage volume.

      If you use a local volume for persistent storage, do not use a raw block volume, which is described with volumeMode: block in the LocalVolume object. Elasticsearch cannot use raw block volumes.

      Elasticsearch is a memory-intensive application. By default, OKD installs three Elasticsearch nodes with memory requests and limits of 16 GB. This initial set of three OKD nodes might not have enough memory to run Elasticsearch within your cluster. If you experience memory issues that are related to Elasticsearch, add more Elasticsearch nodes to your cluster rather than increasing the memory on existing nodes.

    • Ensure that you have downloaded the as shown in Obtaining the installation program in the installation documentation for your platform.

      If you have the pull secret, add the redhat-operators catalog to the OperatorHub custom resource (CR) as shown in Configuring OKD to use Red Hat Operators.

    Procedure

    To install the OpenShift Elasticsearch Operator and Red Hat OpenShift Logging Operator using the OKD web console:

    1. Install the OpenShift Elasticsearch Operator:

      1. In the OKD web console, click OperatorsOperatorHub.

      2. Choose OpenShift Elasticsearch Operator from the list of available Operators, and click Install.

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

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

        You must specify the openshift-operators-redhat namespace. The openshift-operators namespace might contain Community Operators, which are untrusted and could publish a metric with the same name as an OKD metric, which would cause conflicts.

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

      6. Select stable-5.x as the Update Channel.

      7. Select an Approval Strategy.

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

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

      8. Click Install.

      9. Verify that the OpenShift Elasticsearch Operator installed by switching to the OperatorsInstalled Operators page.

      10. Ensure that OpenShift Elasticsearch Operator is listed in all projects with a Status of Succeeded.

    2. Install the Red Hat OpenShift Logging Operator:

      1. In the OKD web console, click OperatorsOperatorHub.

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

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

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

      5. 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-logging namespace.

      6. Select stable-5.x as the Update Channel.

      7. Select an Approval Strategy.

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

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

      8. Click Install.

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

      10. Ensure that Red Hat OpenShift Logging is listed in the openshift-logging project with a Status of Succeeded.

        If the Operator does not appear as installed, to troubleshoot further:

        • Switch to the OperatorsInstalled Operators page and inspect the Status column for any errors or failures.

        • Switch to the WorkloadsPods page and check the logs in any pods in the openshift-logging project that are reporting issues.

    1. Create a OpenShift Logging instance:

      1. Switch to the AdministrationCustom Resource Definitions page.

      2. On the Custom Resource Definitions page, click ClusterLogging.

      3. On the Custom Resource Definition details page, select View Instances from the Actions menu.

      4. On the ClusterLoggings page, click Create ClusterLogging.

        You might have to refresh the page to load the data.

      5. In the YAML field, replace the code with the following:

        This default OpenShift Logging configuration should support a wide array of environments. Review the topics on tuning and configuring OpenShift Logging components for information on modifications you can make to your OpenShift Logging cluster.

        1The name must be instance.
        2The OpenShift Logging management state. In some cases, if you change the OpenShift Logging defaults, you must set this to Unmanaged. However, an unmanaged deployment does not receive updates until OpenShift Logging is placed back into a managed state.
        3Settings for configuring Elasticsearch. Using the CR, you can configure shard replication policy and persistent storage.
        4Specify the length of time that Elasticsearch should retain each log source. Enter an integer and a time designation: weeks(w), hours(h/H), minutes(m) and seconds(s). For example, 7d for seven days. Logs older than the maxAge are deleted. You must specify a retention policy for each log source or the Elasticsearch indices will not be created for that source.
        5Specify the number of Elasticsearch nodes. See the note that follows this list.
        6Enter the name of an existing storage class for Elasticsearch storage. For best performance, specify a storage class that allocates block storage. If you do not specify a storage class, OpenShift Logging uses ephemeral storage.
        7Specify the CPU and memory requests for Elasticsearch as needed. If you leave these values blank, the OpenShift Elasticsearch Operator sets default values that should be sufficient for most deployments. The default values are 16G for the memory request and 1 for the CPU request.
        8Specify the CPU and memory requests for the Elasticsearch proxy as needed. If you leave these values blank, the OpenShift Elasticsearch Operator sets default values that should be sufficient for most deployments. The default values are 256Mi for the memory request and 100m for the CPU request.
        9Settings for configuring Kibana. Using the CR, you can scale Kibana for redundancy and configure the CPU and memory for your Kibana nodes. For more information, see Configuring the log visualizer.
        10Settings for configuring Fluentd. Using the CR, you can configure Fluentd CPU and memory limits. For more information, see Configuring Fluentd.

        The maximum number of Elasticsearch control plane nodes (also known as the master nodes) is three. If you specify a nodeCount greater than 3, OKD creates three Elasticsearch nodes that are Master-eligible nodes, with the master, client, and data roles. The additional Elasticsearch nodes are created as Data-only nodes, using client and data roles. Control plane nodes perform cluster-wide actions such as creating or deleting an index, shard allocation, and tracking nodes. Data nodes hold the shards and perform data-related operations such as CRUD, search, and aggregations. Data-related operations are I/O-, memory-, and CPU-intensive. It is important to monitor these resources and to add more Data nodes if the current nodes are overloaded.

        1. $ oc get deployment
        Example output
        1. cluster-logging-operator 1/1 1 1 18h
        2. elasticsearch-cd-x6kdekli-1 0/1 1 0 6m54s
        3. elasticsearch-cdm-x6kdekli-1 1/1 1 1 18h
        4. elasticsearch-cdm-x6kdekli-2 0/1 1 0 6m49s
        5. elasticsearch-cdm-x6kdekli-3 0/1 1 0 6m44s

        The number of primary shards for the index templates is equal to the number of Elasticsearch data nodes.

      6. Click Create. This creates the OpenShift Logging components, the Elasticsearch custom resource and components, and the Kibana interface.

    2. Verify the install:

      1. Switch to the WorkloadsPods page.

      2. Select the openshift-logging project.

        You should see several pods for OpenShift Logging, Elasticsearch, Fluentd, and Kibana similar to the following list:

        • cluster-logging-operator-cb795f8dc-xkckc

        • elasticsearch-cdm-b3nqzchd-1-5c6797-67kfz

        • elasticsearch-cdm-b3nqzchd-2-6657f4-wtprv

        • elasticsearch-cdm-b3nqzchd-3-588c65-clg7g

        • fluentd-2c7dg

        • fluentd-9z7kk

        • fluentd-br7r2

        • fluentd-fn2sb

        • fluentd-pb2f8

        • fluentd-zqgqx

        • kibana-7fb4fd4cc9-bvt4p

    Additional resources

    If you plan to use Kibana, you must to explore and visualize data in Kibana.

    If your cluster network provider enforces network isolation, allow network traffic between the projects that contain the OpenShift Logging operators.

    You can use the OKD CLI to install the OpenShift Elasticsearch and Red Hat OpenShift Logging Operators.

    Prerequisites

    • Ensure that you have the necessary persistent storage for Elasticsearch. Note that each Elasticsearch node requires its own storage volume.

      Elasticsearch is a memory-intensive application. By default, OKD installs three Elasticsearch nodes with memory requests and limits of 16 GB. This initial set of three OKD nodes might not have enough memory to run Elasticsearch within your cluster. If you experience memory issues that are related to Elasticsearch, add more Elasticsearch nodes to your cluster rather than increasing the memory on existing nodes.

    • Ensure that you have downloaded the as shown in Obtaining the installation program in the installation documentation for your platform.

      If you have the pull secret, add the redhat-operators catalog to the OperatorHub custom resource (CR) as shown in Configuring OKD to use Red Hat Operators.

    Procedure

    To install the OpenShift Elasticsearch Operator and Red Hat OpenShift Logging Operator using the CLI:

    1. Create a namespace for the OpenShift Elasticsearch Operator.

      1. Create a namespace object YAML file (for example, eo-namespace.yaml) for the OpenShift Elasticsearch Operator:

        1. apiVersion: v1
        2. kind: Namespace
        3. metadata:
        4. name: openshift-operators-redhat (1)
        5. annotations:
        6. openshift.io/node-selector: ""
        7. openshift.io/cluster-monitoring: "true" (2)
        1You must specify the openshift-operators-redhat namespace. To prevent possible conflicts with metrics, you should configure the Prometheus Cluster Monitoring stack to scrape metrics from the openshift-operators-redhat namespace and not the openshift-operators namespace. The openshift-operators namespace might contain community Operators, which are untrusted and could publish a metric with the same name as an OKD metric, which would cause conflicts.
        2String. You must specify this label as shown to ensure that cluster monitoring scrapes the openshift-operators-redhat namespace.
      2. Create the namespace:

        1. $ oc create -f <file-name>.yaml

        For example:

        1. $ oc create -f eo-namespace.yaml
    2. Create a namespace for the Red Hat OpenShift Logging Operator:

      1. Create a namespace object YAML file (for example, olo-namespace.yaml) for the Red Hat OpenShift Logging Operator:

        1. apiVersion: v1
        2. kind: Namespace
        3. metadata:
        4. name: openshift-logging
        5. annotations:
        6. openshift.io/node-selector: ""
        7. labels:
        8. openshift.io/cluster-monitoring: "true"
      2. Create the namespace:

        1. $ oc create -f <file-name>.yaml

        For example:

        1. $ oc create -f olo-namespace.yaml
    3. Install the OpenShift Elasticsearch Operator by creating the following objects:

      1. Create an Operator Group object YAML file (for example, eo-og.yaml) for the OpenShift Elasticsearch Operator:

        1. apiVersion: operators.coreos.com/v1
        2. kind: OperatorGroup
        3. metadata:
        4. name: openshift-operators-redhat
        5. namespace: openshift-operators-redhat (1)
        6. spec: {}
        1You must specify the openshift-operators-redhat namespace.
      2. Create an Operator Group object:

        1. $ oc create -f <file-name>.yaml

        For example:

        1. $ oc create -f eo-og.yaml
      3. Create a Subscription object YAML file (for example, eo-sub.yaml) to subscribe a namespace to the OpenShift Elasticsearch Operator.

        Example Subscription

        1You must specify the openshift-operators-redhat namespace.
        2Specify 5.0, stable, or as the channel. See the following note.
        3Specify redhat-operators. If your OKD cluster is installed on a restricted network, also known as a disconnected cluster, specify the name of the CatalogSource object created when you configured the Operator Lifecycle Manager (OLM).

        Specifying stable installs the current version of the latest stable release. Using stable with installPlanApproval: “Automatic”, will automatically upgrade your operators to the latest stable major and minor release.

        Specifying stable-5.<x> installs the current minor version of a specific major release. Using stable-5.<x> with installPlanApproval: “Automatic”, will automatically upgrade your operators to the latest stable minor release within the major release you specify with x.

      4. Create the Subscription object:

        1. $ oc create -f <file-name>.yaml

        For example:

        1. $ oc create -f eo-sub.yaml

        The OpenShift Elasticsearch Operator is installed to the openshift-operators-redhat namespace and copied to each project in the cluster.

      5. Verify the Operator installation:

        1. $ oc get csv --all-namespaces

        Example output

        1. NAMESPACE NAME DISPLAY VERSION REPLACES PHASE
        2. default elasticsearch-operator.5.1.0-202007012112.p0 OpenShift Elasticsearch Operator 5.1.0-202007012112.p0 Succeeded
        3. kube-node-lease elasticsearch-operator.5.1.0-202007012112.p0 OpenShift Elasticsearch Operator 5.1.0-202007012112.p0 Succeeded
        4. kube-public elasticsearch-operator.5.1.0-202007012112.p0 OpenShift Elasticsearch Operator 5.1.0-202007012112.p0 Succeeded
        5. kube-system elasticsearch-operator.5.1.0-202007012112.p0 OpenShift Elasticsearch Operator 5.1.0-202007012112.p0 Succeeded
        6. openshift-apiserver-operator elasticsearch-operator.5.1.0-202007012112.p0 OpenShift Elasticsearch Operator 5.1.0-202007012112.p0 Succeeded
        7. openshift-apiserver elasticsearch-operator.5.1.0-202007012112.p0 OpenShift Elasticsearch Operator 5.1.0-202007012112.p0 Succeeded
        8. openshift-authentication-operator elasticsearch-operator.5.1.0-202007012112.p0 OpenShift Elasticsearch Operator 5.1.0-202007012112.p0 Succeeded
        9. openshift-authentication elasticsearch-operator.5.1.0-202007012112.p0 OpenShift Elasticsearch Operator 5.1.0-202007012112.p0 Succeeded
        10. ...

        There should be an OpenShift Elasticsearch Operator in each namespace. The version number might be different than shown.

    4. Install the Red Hat OpenShift Logging Operator by creating the following objects:

      1. Create an Operator Group object YAML file (for example, olo-og.yaml) for the Red Hat OpenShift Logging Operator:

        1. apiVersion: operators.coreos.com/v1
        2. kind: OperatorGroup
        3. metadata:
        4. name: cluster-logging
        5. namespace: openshift-logging (1)
        6. spec:
        7. targetNamespaces:
        8. - openshift-logging (1)
      2. Create the OperatorGroup object:

        1. $ oc create -f <file-name>.yaml
        1. $ oc create -f olo-og.yaml
      3. Create a Subscription object YAML file (for example, olo-sub.yaml) to subscribe a namespace to the Red Hat OpenShift Logging Operator.

        1. apiVersion: operators.coreos.com/v1alpha1
        2. kind: Subscription
        3. metadata:
        4. name: cluster-logging
        5. namespace: openshift-logging (1)
        6. spec:
        7. channel: "stable" (2)
        8. name: cluster-logging
        9. source: redhat-operators (3)
        10. sourceNamespace: openshift-marketplace
        1You must specify the openshift-logging namespace.
        2Specify 5.0, stable, or stable-5.<x> as the channel.
        3Specify redhat-operators. If your OKD cluster is installed on a restricted network, also known as a disconnected cluster, specify the name of the CatalogSource object you created when you configured the Operator Lifecycle Manager (OLM).
        1. $ oc create -f <file-name>.yaml

        For example:

        1. $ oc create -f olo-sub.yaml

        The Red Hat OpenShift Logging Operator is installed to the openshift-logging namespace.

      4. Verify the Operator installation.

        There should be a Red Hat OpenShift Logging Operator in the openshift-logging namespace. The Version number might be different than shown.

        1. $ oc get csv -n openshift-logging

        Example output

    5. Create a OpenShift Logging instance:

      1. Create an instance object YAML file (for example, olo-instance.yaml) for the Red Hat OpenShift Logging Operator:

        This default OpenShift Logging configuration should support a wide array of environments. Review the topics on tuning and configuring OpenShift Logging components for information on modifications you can make to your OpenShift Logging cluster.

        1. apiVersion: "logging.openshift.io/v1"
        2. kind: "ClusterLogging"
        3. name: "instance" (1)
        4. namespace: "openshift-logging"
        5. spec:
        6. managementState: "Managed" (2)
        7. logStore:
        8. type: "elasticsearch" (3)
        9. retentionPolicy: (4)
        10. application:
        11. maxAge: 1d
        12. infra:
        13. maxAge: 7d
        14. audit:
        15. maxAge: 7d
        16. elasticsearch:
        17. nodeCount: 3 (5)
        18. storageClassName: "<storage-class-name>" (6)
        19. size: 200G
        20. resources: (7)
        21. requests:
        22. memory: "8Gi"
        23. proxy: (8)
        24. resources:
        25. limits:
        26. memory: 256Mi
        27. requests:
        28. memory: 256Mi
        29. redundancyPolicy: "SingleRedundancy"
        30. visualization:
        31. type: "kibana" (9)
        32. kibana:
        33. replicas: 1
        34. collection:
        35. logs:
        36. type: "fluentd" (10)
        37. fluentd: {}
        1The name must be instance.
        2The OpenShift Logging management state. In some cases, if you change the OpenShift Logging defaults, you must set this to Unmanaged. However, an unmanaged deployment does not receive updates until OpenShift Logging is placed back into a managed state. Placing a deployment back into a managed state might revert any modifications you made.
        3Settings for configuring Elasticsearch. Using the custom resource (CR), you can configure shard replication policy and persistent storage.
        4Specify the length of time that Elasticsearch should retain each log source. Enter an integer and a time designation: weeks(w), hours(h/H), minutes(m) and seconds(s). For example, 7d for seven days. Logs older than the maxAge are deleted. You must specify a retention policy for each log source or the Elasticsearch indices will not be created for that source.
        5Specify the number of Elasticsearch nodes. See the note that follows this list.
        6Enter the name of an existing storage class for Elasticsearch storage. For best performance, specify a storage class that allocates block storage. If you do not specify a storage class, OKD deploys OpenShift Logging with ephemeral storage only.
        7Specify the CPU and memory requests for Elasticsearch as needed. If you leave these values blank, the OpenShift Elasticsearch Operator sets default values that should be sufficient for most deployments. The default values are 16G for the memory request and 1 for the CPU request.
        8Specify the CPU and memory requests for the Elasticsearch proxy as needed. If you leave these values blank, the OpenShift Elasticsearch Operator sets default values that should be sufficient for most deployments. The default values are 256Mi for the memory request and 100m for the CPU request.
        9Settings for configuring Kibana. Using the CR, you can scale Kibana for redundancy and configure the CPU and memory for your Kibana pods. For more information, see Configuring the log visualizer.
        10Settings for configuring Fluentd. Using the CR, you can configure Fluentd CPU and memory limits. For more information, see Configuring Fluentd.

        The maximum number of Elasticsearch control plane nodes is three. If you specify a nodeCount greater than 3, OKD creates three Elasticsearch nodes that are Master-eligible nodes, with the master, client, and data roles. The additional Elasticsearch nodes are created as Data-only nodes, using client and data roles. Control plane nodes perform cluster-wide actions such as creating or deleting an index, shard allocation, and tracking nodes. Data nodes hold the shards and perform data-related operations such as CRUD, search, and aggregations. Data-related operations are I/O-, memory-, and CPU-intensive. It is important to monitor these resources and to add more Data nodes if the current nodes are overloaded.

        For example, if nodeCount=4, the following nodes are created:

        1. $ oc get deployment
        Example output
        1. cluster-logging-operator 1/1 1 1 18h
        2. elasticsearch-cd-x6kdekli-1 1/1 1 0 6m54s
        3. elasticsearch-cdm-x6kdekli-1 1/1 1 1 18h
        4. elasticsearch-cdm-x6kdekli-2 1/1 1 0 6m49s
        5. elasticsearch-cdm-x6kdekli-3 1/1 1 0 6m44s

        The number of primary shards for the index templates is equal to the number of Elasticsearch data nodes.

      2. Create the instance:

        1. $ oc create -f <file-name>.yaml

        For example:

        1. $ oc create -f olo-instance.yaml

        This creates the OpenShift Logging components, the Elasticsearch custom resource and components, and the Kibana interface.

    6. Verify the installation by listing the pods in the openshift-logging project.

      You should see several pods for OpenShift Logging, Elasticsearch, Fluentd, and Kibana similar to the following list:

      1. $ oc get pods -n openshift-logging

      Example output

      1. NAME READY STATUS RESTARTS AGE
      2. cluster-logging-operator-66f77ffccb-ppzbg 1/1 Running 0 7m
      3. elasticsearch-cdm-ftuhduuw-1-ffc4b9566-q6bhp 2/2 Running 0 2m40s
      4. elasticsearch-cdm-ftuhduuw-2-7b4994dbfc-rd2gc 2/2 Running 0 2m36s
      5. elasticsearch-cdm-ftuhduuw-3-84b5ff7ff8-gqnm2 2/2 Running 0 2m4s
      6. fluentd-587vb 1/1 Running 0 2m26s
      7. fluentd-7mpb9 1/1 Running 0 2m30s
      8. fluentd-flm6j 1/1 Running 0 2m33s
      9. fluentd-gn4rn 1/1 Running 0 2m26s
      10. fluentd-nlgb6 1/1 Running 0 2m30s
      11. fluentd-snpkt 1/1 Running 0 2m28s
      12. kibana-d6d5668c5-rppqm 2/2 Running 0 2m39s

    If you plan to use Kibana, you must manually create your Kibana index patterns and visualizations to explore and visualize data in Kibana.

    If your cluster network provider enforces network isolation, .

    An index pattern defines the Elasticsearch indices that you want to visualize. To explore and visualize data in Kibana, you must create an index pattern.

    Prerequisites

    • A user must have the cluster-admin role, the cluster-reader role, or both roles to view the infra and audit indices in Kibana. The default kubeadmin user has proper permissions to view these indices.

      If you can view the pods and logs in the default, kube- and openshift- projects, you should be able to access these indices. You can use the following command to check if the current user has appropriate permissions:

      1. $ oc auth can-i get pods/log -n <project>

      Example output

      1. yes
    • Elasticsearch documents must be indexed before you can create index patterns. This is done automatically, but it might take a few minutes in a new or updated cluster.

    Procedure

    To define index patterns and create visualizations in Kibana:

    1. In the OKD console, click the Application Launcher and select Logging.

    2. Create your Kibana index patterns by clicking ManagementIndex PatternsCreate index pattern:

      • Each user must manually create index patterns when logging into Kibana the first time to see logs for their projects. Users must create an index pattern named app and use the @timestamp time field to view their container logs.

      • Each admin user must create index patterns when logged into Kibana the first time for the app, infra, and audit indices using the @timestamp time field.

    3. Create Kibana Visualizations from the new index patterns.

    Allowing traffic between projects when network isolation is enabled

    Your cluster network provider might enforce network isolation. If so, you must allow network traffic between the projects that contain the operators deployed by OpenShift Logging.

    Network isolation blocks network traffic between pods or services that are in different projects. OpenShift Logging installs the OpenShift Elasticsearch Operator in the openshift-operators-redhat project and the Red Hat OpenShift Logging Operator in the openshift-logging project. Therefore, you must allow traffic between these two projects.

    OKD offers two supported choices for the default Container Network Interface (CNI) network provider, OpenShift SDN and OVN-Kubernetes. These two providers implement various network isolation policies.

    OpenShift SDN has three modes:

    network policy

    This is the default mode. If no policy is defined, it allows all traffic. However, if a user defines a policy, they typically start by denying all traffic and then adding exceptions. This process might break applications that are running in different projects. Therefore, explicitly configure the policy to allow traffic to egress from one logging-related project to the other.

    multitenant

    This mode enforces network isolation. You must join the two logging-related projects to allow traffic between them.

    subnet

    This mode allows all traffic. It does not enforce network isolation. No action is needed.

    OVN-Kubernetes always uses a network policy. Therefore, as with OpenShift SDN, you must configure the policy to allow traffic to egress from one logging-related project to the other.

    Procedure

    • If you are using OpenShift SDN in multitenant mode, join the two projects. For example:

      1. $ oc adm pod-network join-projects --to=openshift-operators-redhat openshift-logging
    • Otherwise, for OpenShift SDN in network policy mode and OVN-Kubernetes, perform the following actions:

      1. Set a label on the openshift-operators-redhat namespace. For example:

        1. $ oc label namespace openshift-operators-redhat project=openshift-operators-redhat
      2. Create a network policy object in the openshift-logging namespace that allows ingress from the project to the openshift-logging project. For example:

    Additional resources