|
| 1 | +// Module is included in the following assemblies: |
| 2 | +// logging/cluster-logging-loki.adoc |
| 3 | +:_content-type: PROCEDURE |
| 4 | +[id="logging-loki-cli-install_{context}"] |
| 5 | += Installing logging Operators using the {product-title} CLI |
| 6 | + |
| 7 | +To install and configure logging on your {product-title} cluster, additional Operators must be installed. This can be done from the {product-title} CLI. |
| 8 | + |
| 9 | +{Product-title} Operators use custom resources (CR) to manage applications and their components. High-level configuration and settings are provided by the user within a CR. The Operator translates high-level directives into low-level actions, based on best practices embedded within the Operator’s logic. A custom resource definition (CRD) defines a CR and lists all the configurations available to users of the Operator. Installing an Operator creates the CRDs, which are then used to generate CRs. |
| 10 | + |
| 11 | +.Prerequisites |
| 12 | + |
| 13 | +* Supported object store (AWS S3, Google Cloud Storage, Azure, Swift, Minio, OpenShift Data Foundation) |
| 14 | +
|
| 15 | +.Procedure |
| 16 | + |
| 17 | +. Install the `Loki Operator` by creating the following objects: |
| 18 | + |
| 19 | +.. Create a Subscription object YAML file (for example, `olo-sub.yaml`) to |
| 20 | +subscribe a namespace to the Loki Operator using the template below: |
| 21 | ++ |
| 22 | +[source,terminal] |
| 23 | +---- |
| 24 | +$ oc create -f <file-name>.yaml |
| 25 | +---- |
| 26 | + |
| 27 | +[source,yaml] |
| 28 | +---- |
| 29 | +apiVersion: operators.coreos.com/v1alpha1 |
| 30 | +kind: Subscription |
| 31 | +metadata: |
| 32 | + name: loki-operator |
| 33 | + namespace: openshift-operators-redhat <1> |
| 34 | +spec: |
| 35 | + charsion: operators.coreos.com/v1alpha1 |
| 36 | +kind: Subscription |
| 37 | +metadata: |
| 38 | + name: loki-operator |
| 39 | + namespace: openshift-operators-redhat <1> |
| 40 | +spec: |
| 41 | + channel: stable <2> |
| 42 | + name: loki-operator |
| 43 | + source: redhat-operators <3> |
| 44 | + sourceNamespace: openshift-marketplace |
| 45 | +---- |
| 46 | +<1> You must specify the `openshift-operators-redhat` namespace. |
| 47 | +<2> Specify `stable`, or `stable-5.<y>` as the channel. |
| 48 | +<3> Specify `redhat-operators`. If your {product-title} 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). |
| 49 | + |
| 50 | +. Create a LokiStack instance: |
| 51 | + |
| 52 | +.. Create an instance object YAML file (for example, `logging-loki.yaml`) using the template below: |
| 53 | ++ |
| 54 | +[source,terminal] |
| 55 | +---- |
| 56 | +$ oc create -f <file-name>.yaml |
| 57 | +---- |
| 58 | + |
| 59 | +[source,yaml] |
| 60 | +---- |
| 61 | +apiVersion: loki.grafana.com/v1 |
| 62 | +kind: LokiStack |
| 63 | +metadata: |
| 64 | + name: logging-loki |
| 65 | + namespace: openshift-logging |
| 66 | +spec: |
| 67 | + size: 1x.small # <1> |
| 68 | + storage: |
| 69 | + schemas: |
| 70 | + - version: v12 |
| 71 | + effectiveDate: "2022-06-01" |
| 72 | + secret: |
| 73 | + name: logging-loki-s3 # <2> |
| 74 | + type: s3 # <3> |
| 75 | + storageClassName: <storage_class_name> # <4> |
| 76 | + tenants: |
| 77 | + mode: openshift-logging |
| 78 | +---- |
| 79 | +<1> Supported size options for production instances of Loki are `1x.small` and `1x.medium`. |
| 80 | +<2> Enter the name of your log store secret. |
| 81 | +<3> Enter the type of your log store secret. |
| 82 | +<4> Enter 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`. |
| 83 | + |
| 84 | +. Install the `Red Hat OpenShift Logging` Operator by creating the following objects: |
| 85 | + |
| 86 | +.. Create an Operator Group object YAML file (for example, `olo-og.yaml`) using the template below: |
| 87 | ++ |
| 88 | +[source,terminal] |
| 89 | +---- |
| 90 | +$ oc create -f <file-name>.yaml |
| 91 | +---- |
| 92 | + |
| 93 | +[source,yaml] |
| 94 | +---- |
| 95 | +apiVersion: operators.coreos.com/v1 |
| 96 | +kind: OperatorGroup |
| 97 | +metadata: |
| 98 | + name: cluster-logging |
| 99 | + namespace: openshift-logging # <1> |
| 100 | +spec: |
| 101 | + targetNamespaces: |
| 102 | + - openshift-logging |
| 103 | +---- |
| 104 | +<1> You must specify the `openshift-logging` namespace. |
| 105 | + |
| 106 | +.. Create a Subscription object YAML file (for example, `olo-sub.yaml`) to |
| 107 | +subscribe a namespace to the Red Hat OpenShift Logging Operator using the template below: |
| 108 | ++ |
| 109 | +[source,terminal] |
| 110 | +---- |
| 111 | +$ oc create -f <file-name>.yaml |
| 112 | +---- |
| 113 | + |
| 114 | +[source,yaml] |
| 115 | +---- |
| 116 | +apiVersion: operators.coreos.com/v1alpha1 |
| 117 | +kind: Subscription |
| 118 | +metadata: |
| 119 | + name: cluster-logging |
| 120 | + namespace: openshift-logging # <1> |
| 121 | +spec: |
| 122 | + channel: stable # <2> |
| 123 | + name: cluster-logging |
| 124 | + source: redhat-operators # <3> |
| 125 | + sourceNamespace: openshift-marketplace |
| 126 | +---- |
| 127 | +<1> You must specify the `openshift-logging` namespace. |
| 128 | +<2> Specify `stable`, or `stable-5.<y>` as the channel. |
| 129 | +<3> Specify `redhat-operators`. If your {product-title} 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). |
| 130 | + |
| 131 | + |
| 132 | +.. Verify the Operator installation. |
| 133 | ++ |
| 134 | +There should be a Red Hat OpenShift Logging Operator in the `openshift-logging` namespace. The Version number might be different than what is shown. |
| 135 | ++ |
| 136 | +[source,terminal] |
| 137 | +---- |
| 138 | +$ oc get csv -n openshift-logging |
| 139 | +---- |
| 140 | ++ |
| 141 | +.Example output |
| 142 | +[source,terminal] |
| 143 | +---- |
| 144 | +NAME DISPLAY VERSION REPLACES PHASE |
| 145 | +cluster-logging.v5.7.4 Red Hat OpenShift Logging 5.7.4 cluster-logging.v5.7.3 Succeeded |
| 146 | +---- |
| 147 | + |
| 148 | +. Create an OpenShift Logging instance: |
| 149 | + |
| 150 | +.. Create an instance object YAML file (for example, `olo-instance.yaml`) using the template below: |
| 151 | ++ |
| 152 | +[source,terminal] |
| 153 | +---- |
| 154 | +$ oc create -f <file-name>.yaml |
| 155 | +---- |
| 156 | + |
| 157 | +[source,yaml] |
| 158 | +---- |
| 159 | +apiVersion: logging.openshift.io/v1 |
| 160 | +kind: ClusterLogging |
| 161 | +metadata: |
| 162 | + name: instance |
| 163 | + namespace: openshift-logging |
| 164 | +spec: |
| 165 | + logStore: |
| 166 | + type: lokistack |
| 167 | + lokistack: |
| 168 | + name: logging-loki |
| 169 | + collection: |
| 170 | + type: vector |
| 171 | +---- |
| 172 | + |
| 173 | +. Verify the installation by listing the pods in the *openshift-logging* project. |
| 174 | ++ |
| 175 | +You should see several pods for components of the Logging subsystem, similar to the following list: |
| 176 | ++ |
| 177 | +[source,terminal] |
| 178 | +---- |
| 179 | +$ oc get pods -n openshift-logging |
| 180 | +---- |
| 181 | ++ |
| 182 | +.Example output |
| 183 | +[source,terminal] |
| 184 | +---- |
| 185 | +$ oc get pods -n openshift-logging |
| 186 | +NAME READY STATUS RESTARTS AGE |
| 187 | +cluster-logging-operator-fb7f7cf69-8jsbq 1/1 Running 0 98m |
| 188 | +collector-222js 2/2 Running 0 18m |
| 189 | +collector-g9ddv 2/2 Running 0 18m |
| 190 | +collector-hfqq8 2/2 Running 0 18m |
| 191 | +collector-sphwg 2/2 Running 0 18m |
| 192 | +collector-vv7zn 2/2 Running 0 18m |
| 193 | +collector-wk5zz 2/2 Running 0 18m |
| 194 | +logging-view-plugin-6f76fbb78f-n2n4n 1/1 Running 0 18m |
| 195 | +lokistack-sample-compactor-0 1/1 Running 0 42m |
| 196 | +lokistack-sample-distributor-7d7688bcb9-dvcj8 1/1 Running 0 42m |
| 197 | +lokistack-sample-gateway-5f6c75f879-bl7k9 2/2 Running 0 42m |
| 198 | +lokistack-sample-gateway-5f6c75f879-xhq98 2/2 Running 0 42m |
| 199 | +lokistack-sample-index-gateway-0 1/1 Running 0 42m |
| 200 | +lokistack-sample-ingester-0 1/1 Running 0 42m |
| 201 | +lokistack-sample-querier-6b7b56bccc-2v9q4 1/1 Running 0 42m |
| 202 | +lokistack-sample-query-frontend-84fb57c578-gq2f7 1/1 Running 0 42m |
| 203 | +---- |
0 commit comments