|
| 1 | +:_mod-docs-content-type: PROCEDURE |
| 2 | +[id="log6x-installing-logging-operator-using-web-console_{context}"] |
| 3 | += Installing {clo} by using the web console |
| 4 | + |
| 5 | +Install {clo} on your {product-title} cluster to collect and forward logs to a log store from the OperatorHub by using the {product-title} web console. |
| 6 | + |
| 7 | +.Prerequisites |
| 8 | + |
| 9 | +* You have administrator permissions. |
| 10 | +* You have access to the {product-title} web console. |
| 11 | +* You installed and configured {loki-op}. |
| 12 | +
|
| 13 | +.Procedure |
| 14 | + |
| 15 | +. In the {product-title} web console *Administrator* perspective, go to *Operators* -> *OperatorHub*. |
| 16 | + |
| 17 | +. Type {clo} in the *Filter by keyword* field. Click *{clo}* in the list of available Operators, and then click *Install*. |
| 18 | + |
| 19 | +. Select *stable-x.y* as the *Update channel*. The latest version is already selected in the *Version* field. |
| 20 | ++ |
| 21 | +The {clo} must be deployed to the {logging} namespace `openshift-logging`, so the *Installation mode* and *Installed Namespace* are already selected. If this namespace does not already exist, it will be created for you. |
| 22 | + |
| 23 | +. Select *Enable Operator-recommended cluster monitoring on this namespace.* |
| 24 | ++ |
| 25 | +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. |
| 26 | + |
| 27 | +. For *Update approval* select *Automatic*, then click *Install*. |
| 28 | ++ |
| 29 | +If the approval strategy in the subscription is set to *Automatic*, the update process initiates as soon as a new operator version is available in the selected channel. If the approval strategy is set to *Manual*, you must manually approve pending updates. |
| 30 | ++ |
| 31 | +[NOTE] |
| 32 | +==== |
| 33 | +An Operator might display a `Failed` status before the installation completes. If the operator installation completes with an `InstallSucceeded` message, refresh the page. |
| 34 | +==== |
| 35 | + |
| 36 | +. While the operator installs, create the service account that will be used by the log collector to collect the logs. |
| 37 | + |
| 38 | +.. Click the *+* in the top right of the screen to access the *Import YAML* page. |
| 39 | + |
| 40 | +.. Enter the YAML definition for the service account. |
| 41 | ++ |
| 42 | +.Example `ServiceAccount` object |
| 43 | +[source,yaml] |
| 44 | +---- |
| 45 | +apiVersion: v1 |
| 46 | +kind: ServiceAccount |
| 47 | +metadata: |
| 48 | + name: logging-collector # <1> |
| 49 | + namespace: openshift-logging # <2> |
| 50 | +---- |
| 51 | +<1> Note down the name used for the service account `logging-collector` to use it later when creating the `ClusterLogForwarder` resource. |
| 52 | +<2> Set the namespace to `openshift-logging` because that is the namespace for deploying the `ClusterLogForwarder` resource. |
| 53 | + |
| 54 | +.. Click the *Create* button. |
| 55 | + |
| 56 | +. Create the `ClusterRoleBinding` objects to grant the necessary permissions to the log collector for accessing the logs that you want to collect and to write the log store, for example infrastructure and application logs. |
| 57 | + |
| 58 | +.. Click the *+* in the top right of the screen to access the *Import YAML* page. |
| 59 | + |
| 60 | +.. Enter the YAML definition for the `ClusterRoleBinding` resources. |
| 61 | ++ |
| 62 | +.Example `ClusterRoleBinding` resources |
| 63 | +[source,yaml] |
| 64 | +---- |
| 65 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 66 | +kind: ClusterRoleBinding |
| 67 | +metadata: |
| 68 | + name: logging-collector:write-logs |
| 69 | +roleRef: |
| 70 | + apiGroup: rbac.authorization.k8s.io |
| 71 | + kind: ClusterRole |
| 72 | + name: logging-collector-logs-writer # <1> |
| 73 | +subjects: |
| 74 | +- kind: ServiceAccount |
| 75 | + name: logging-collector |
| 76 | + namespace: openshift-logging |
| 77 | +--- |
| 78 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 79 | +kind: ClusterRoleBinding |
| 80 | +metadata: |
| 81 | + name: logging-collector:collect-application |
| 82 | +roleRef: |
| 83 | + apiGroup: rbac.authorization.k8s.io |
| 84 | + kind: ClusterRole |
| 85 | + name: collect-application-logs # <2> |
| 86 | +subjects: |
| 87 | +- kind: ServiceAccount |
| 88 | + name: logging-collector |
| 89 | + namespace: openshift-logging |
| 90 | +--- |
| 91 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 92 | +kind: ClusterRoleBinding |
| 93 | +metadata: |
| 94 | + name: logging-collector:collect-infrastructure |
| 95 | +roleRef: |
| 96 | + apiGroup: rbac.authorization.k8s.io |
| 97 | + kind: ClusterRole |
| 98 | + name: collect-infrastructure-logs # <3> |
| 99 | +subjects: |
| 100 | +- kind: ServiceAccount |
| 101 | + name: logging-collector |
| 102 | + namespace: openshift-logging |
| 103 | +---- |
| 104 | +<1> The cluster role to allow the log collector to write logs to LokiStack. |
| 105 | +<2> The cluster role to allow the log collector to collect logs from applications. |
| 106 | +<3> The cluster role to allow the log collector to collect logs from infrastructure. |
| 107 | + |
| 108 | +.. Click the *Create* button. |
| 109 | + |
| 110 | +. Go to the *Operators* -> *Installed Operators* page. Select the operator and click the *All instances* tab. |
| 111 | + |
| 112 | +. After granting the necessary permissions to the service account, navigate to the *Installed Operators* page. Select the {clo} under the *Provided APIs*, find the *ClusterLogForwarder* resource and click *Create Instance*. |
| 113 | + |
| 114 | +. Select *YAML view*, and then use the following template to create a `ClusterLogForwarder` CR: |
| 115 | ++ |
| 116 | +.Example `ClusterLogForwarder` CR |
| 117 | +[source,yaml] |
| 118 | +---- |
| 119 | +apiVersion: observability.openshift.io/v1 |
| 120 | +kind: ClusterLogForwarder |
| 121 | +metadata: |
| 122 | + name: instance |
| 123 | + namespace: openshift-logging # <1> |
| 124 | +spec: |
| 125 | + serviceAccount: |
| 126 | + name: logging-collector # <2> |
| 127 | + outputs: |
| 128 | + - name: lokistack-out |
| 129 | + type: lokiStack # <3> |
| 130 | + lokiStack: |
| 131 | + target: # <4> |
| 132 | + name: logging-loki |
| 133 | + namespace: openshift-logging |
| 134 | + authentication: |
| 135 | + token: |
| 136 | + from: serviceAccount |
| 137 | + tls: |
| 138 | + ca: |
| 139 | + key: service-ca.crt |
| 140 | + configMapName: openshift-service-ca.crt |
| 141 | + pipelines: |
| 142 | + - name: infra-app-logs |
| 143 | + inputRefs: # <5> |
| 144 | + - application |
| 145 | + - infrastructure |
| 146 | + outputRefs: |
| 147 | + - lokistack-out |
| 148 | +---- |
| 149 | +<1> You must specify `openshift-logging` as the namespace. |
| 150 | +<2> Specify the name of the service account created earlier. |
| 151 | +<3> Select the `lokiStack` output type to send logs to the `LokiStack` instance. |
| 152 | +<4> Point the `ClusterLogForwarder` to the `LokiStack` instance created earlier. |
| 153 | +<5> Select the log output types you want to send to the `LokiStack` instance. |
| 154 | + |
| 155 | +. Click *Create*. |
| 156 | + |
| 157 | +.Verification |
| 158 | +. In the *ClusterLogForwarder* tab verify that you see your `ClusterLogForwarder` instance. |
| 159 | + |
| 160 | +. In the *Status* column, verify that you see the messages: |
| 161 | + |
| 162 | +* `Condition: observability.openshift.io/Authorized` |
| 163 | +* `observability.openshift.io/Valid, Ready` |
0 commit comments