|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * observability/logging/cluster-logging-deploying.adoc |
| 4 | + |
| 5 | +:_mod-docs-content-type: PROCEDURE |
| 6 | +[id="logging-es-deploy-cli_{context}"] |
| 7 | += Installing {logging-uc} with Elasticsearch using the CLI |
| 8 | + |
| 9 | +Elasticsearch is a memory-intensive application. By default, {product-title} installs three Elasticsearch nodes with memory requests and limits of 16 GB. This initial set of three {product-title} 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. |
| 10 | + |
| 11 | + |
| 12 | +.Prerequisites |
| 13 | + |
| 14 | +* Ensure that you have the necessary persistent storage for Elasticsearch. Note that each Elasticsearch node requires its own storage volume. |
| 15 | ++ |
| 16 | +[NOTE] |
| 17 | +==== |
| 18 | +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. |
| 19 | +==== |
| 20 | +
|
| 21 | +ifdef::openshift-origin[] |
| 22 | +* Ensure that you have downloaded the {cluster-manager-url-pull} as shown in _Obtaining the installation program_ in the installation documentation for your platform. |
| 23 | ++ |
| 24 | +If you have the pull secret, add the `redhat-operators` catalog to the OperatorHub custom resource (CR) as shown in *Configuring {product-title} to use Red{nbsp}Hat Operators*. |
| 25 | +endif::[] |
| 26 | + |
| 27 | + |
| 28 | +.Procedure |
| 29 | + |
| 30 | +. Create a `Namespace` object for the {es-op}: |
| 31 | ++ |
| 32 | +.Example `Namespace` object |
| 33 | +[source,yaml] |
| 34 | +---- |
| 35 | +apiVersion: v1 |
| 36 | +kind: Namespace |
| 37 | +metadata: |
| 38 | + name: openshift-operators-redhat # <1> |
| 39 | + annotations: |
| 40 | + openshift.io/node-selector: "" |
| 41 | + labels: |
| 42 | + openshift.io/cluster-monitoring: "true" # <2> |
| 43 | +---- |
| 44 | +<1> You must specify the `openshift-operators-redhat` namespace. The `openshift-operators` |
| 45 | +namespace might contain Community Operators, which are untrusted and could publish |
| 46 | +a metric with the same name as an {product-title} metric, which would cause |
| 47 | +conflicts. |
| 48 | +<2> A string value that specifies the label as shown to ensure that cluster monitoring scrapes the `openshift-operators-redhat` namespace. |
| 49 | + |
| 50 | +. Apply the `Namespace` object by running the following command: |
| 51 | ++ |
| 52 | +[source,terminal] |
| 53 | +---- |
| 54 | +$ oc apply -f <filename>.yaml |
| 55 | +---- |
| 56 | + |
| 57 | +. Create a `Namespace` object for the {clo}: |
| 58 | ++ |
| 59 | +.Example `Namespace` object |
| 60 | +[source,yaml] |
| 61 | +---- |
| 62 | +apiVersion: v1 |
| 63 | +kind: Namespace |
| 64 | +metadata: |
| 65 | + name: openshift-logging # <1> |
| 66 | + annotations: |
| 67 | + openshift.io/node-selector: "" |
| 68 | + labels: |
| 69 | + openshift.io/cluster-monitoring: "true" |
| 70 | +---- |
| 71 | +<1> You must specify `openshift-logging` as the namespace for logging versions 5.7 and earlier. For logging 5.8 and later, you can use any namespace. |
| 72 | + |
| 73 | +. Apply the `Namespace` object by running the following command: |
| 74 | ++ |
| 75 | +[source,terminal] |
| 76 | +---- |
| 77 | +$ oc apply -f <filename>.yaml |
| 78 | +---- |
| 79 | + |
| 80 | +. Create an `OperatorGroup` object for the {es-op}: |
| 81 | ++ |
| 82 | +.Example `OperatorGroup` object |
| 83 | +[source,yaml] |
| 84 | +---- |
| 85 | +apiVersion: operators.coreos.com/v1 |
| 86 | +kind: OperatorGroup |
| 87 | +metadata: |
| 88 | + name: openshift-operators-redhat |
| 89 | + namespace: openshift-operators-redhat # <1> |
| 90 | +spec: {} |
| 91 | +---- |
| 92 | +<1> You must specify the `openshift-operators-redhat` namespace. |
| 93 | + |
| 94 | +. Apply the `OperatorGroup` object by running the following command: |
| 95 | ++ |
| 96 | +[source,terminal] |
| 97 | +---- |
| 98 | +$ oc apply -f <filename>.yaml |
| 99 | +---- |
| 100 | + |
| 101 | +. Create a `Subscription` object to subscribe a namespace to the {es-op}: |
| 102 | ++ |
| 103 | +-- |
| 104 | +include::snippets/logging-stable-updates-snip.adoc[] |
| 105 | +-- |
| 106 | ++ |
| 107 | +.Example `Subscription` object |
| 108 | +[source,yaml] |
| 109 | +---- |
| 110 | +apiVersion: operators.coreos.com/v1alpha1 |
| 111 | +kind: Subscription |
| 112 | +metadata: |
| 113 | + name: elasticsearch-operator |
| 114 | + namespace: openshift-operators-redhat # <1> |
| 115 | +spec: |
| 116 | + channel: <channel> # <2> |
| 117 | + installPlanApproval: Automatic # <3> |
| 118 | + source: redhat-operators # <4> |
| 119 | + sourceNamespace: openshift-marketplace |
| 120 | + name: elasticsearch-operator |
| 121 | +---- |
| 122 | +<1> You must specify the `openshift-operators-redhat` namespace. |
| 123 | +<2> Specify `stable`, or `stable-<x.y>` as the channel. |
| 124 | +<3> `Automatic` allows the Operator Lifecycle Manager (OLM) to automatically update the Operator when a new version is available. `Manual` requires a user with appropriate credentials to approve the Operator update. |
| 125 | +<4> 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) |
| 126 | + |
| 127 | +. Apply the subscription by running the following command: |
| 128 | ++ |
| 129 | +[source,terminal] |
| 130 | +---- |
| 131 | +$ oc apply -f <filename>.yaml |
| 132 | +---- |
| 133 | + |
| 134 | +. Verify the Operator installation by running the following command: |
| 135 | ++ |
| 136 | +[source,terminal] |
| 137 | +---- |
| 138 | +$ oc get csv --all-namespaces |
| 139 | +---- |
| 140 | ++ |
| 141 | +.Example output |
| 142 | +[source,terminal] |
| 143 | +---- |
| 144 | +NAMESPACE NAME DISPLAY VERSION REPLACES PHASE |
| 145 | +default elasticsearch-operator.v5.8.3 OpenShift Elasticsearch Operator 5.8.3 elasticsearch-operator.v5.8.2 Succeeded |
| 146 | +kube-node-lease elasticsearch-operator.v5.8.3 OpenShift Elasticsearch Operator 5.8.3 elasticsearch-operator.v5.8.2 Succeeded |
| 147 | +kube-public elasticsearch-operator.v5.8.3 OpenShift Elasticsearch Operator 5.8.3 elasticsearch-operator.v5.8.2 Succeeded |
| 148 | +kube-system elasticsearch-operator.v5.8.3 OpenShift Elasticsearch Operator 5.8.3 elasticsearch-operator.v5.8.2 Succeeded |
| 149 | +openshift-apiserver-operator elasticsearch-operator.v5.8.3 OpenShift Elasticsearch Operator 5.8.3 elasticsearch-operator.v5.8.2 Succeeded |
| 150 | +openshift-apiserver elasticsearch-operator.v5.8.3 OpenShift Elasticsearch Operator 5.8.3 elasticsearch-operator.v5.8.2 Succeeded |
| 151 | +openshift-authentication-operator elasticsearch-operator.v5.8.3 OpenShift Elasticsearch Operator 5.8.3 elasticsearch-operator.v5.8.2 Succeeded |
| 152 | +openshift-authentication elasticsearch-operator.v5.8.3 OpenShift Elasticsearch Operator 5.8.3 elasticsearch-operator.v5.8.2 Succeeded |
| 153 | +openshift-cloud-controller-manager-operator elasticsearch-operator.v5.8.3 OpenShift Elasticsearch Operator 5.8.3 elasticsearch-operator.v5.8.2 Succeeded |
| 154 | +openshift-cloud-controller-manager elasticsearch-operator.v5.8.3 OpenShift Elasticsearch Operator 5.8.3 elasticsearch-operator.v5.8.2 Succeeded |
| 155 | +openshift-cloud-credential-operator elasticsearch-operator.v5.8.3 OpenShift Elasticsearch Operator 5.8.3 elasticsearch-operator.v5.8.2 Succeeded |
| 156 | +---- |
| 157 | + |
| 158 | +. Create an `OperatorGroup` object for the {clo}: |
| 159 | ++ |
| 160 | +.Example `OperatorGroup` object |
| 161 | +[source,yaml] |
| 162 | +---- |
| 163 | +apiVersion: operators.coreos.com/v1 |
| 164 | +kind: OperatorGroup |
| 165 | +metadata: |
| 166 | + name: cluster-logging |
| 167 | + namespace: openshift-logging # <1> |
| 168 | +spec: |
| 169 | + targetNamespaces: |
| 170 | + - openshift-logging # <2> |
| 171 | +---- |
| 172 | +<1> You must specify `openshift-logging` as the namespace for logging versions 5.7 and earlier. For logging 5.8 and later, you can use any namespace. |
| 173 | +<2> You must specify `openshift-logging` as the namespace for logging versions 5.7 and earlier. For logging 5.8 and later, you can use any namespace. |
| 174 | + |
| 175 | +. Apply the `OperatorGroup` object by running the following command: |
| 176 | ++ |
| 177 | +[source,terminal] |
| 178 | +---- |
| 179 | +$ oc apply -f <filename>.yaml |
| 180 | +---- |
| 181 | + |
| 182 | +. Create a `Subscription` object to subscribe the namespace to the {clo}: |
| 183 | ++ |
| 184 | +.Example `Subscription` object |
| 185 | +[source,yaml] |
| 186 | +---- |
| 187 | +apiVersion: operators.coreos.com/v1alpha1 |
| 188 | +kind: Subscription |
| 189 | +metadata: |
| 190 | + name: cluster-logging |
| 191 | + namespace: openshift-logging # <1> |
| 192 | +spec: |
| 193 | + channel: stable # <2> |
| 194 | + name: cluster-logging |
| 195 | + source: redhat-operators # <3> |
| 196 | + sourceNamespace: openshift-marketplace |
| 197 | +---- |
| 198 | +<1> You must specify the `openshift-logging` namespace for logging versions 5.7 and older. For logging 5.8 and later versions, you can use any namespace. |
| 199 | +<2> Specify `stable` or `stable-x.y` as the channel. |
| 200 | +<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). |
| 201 | + |
| 202 | +. Apply the `subscription` object by running the following command: |
| 203 | ++ |
| 204 | +[source,terminal] |
| 205 | +---- |
| 206 | +$ oc apply -f <filename>.yaml |
| 207 | +---- |
| 208 | + |
| 209 | +. Create a `ClusterLogging` object as a YAML file: |
| 210 | ++ |
| 211 | +-- |
| 212 | +.Example `ClusterLogging` object |
| 213 | +[source,yaml] |
| 214 | +---- |
| 215 | +apiVersion: logging.openshift.io/v1 |
| 216 | +kind: ClusterLogging |
| 217 | +metadata: |
| 218 | + name: instance # <1> |
| 219 | + namespace: openshift-logging |
| 220 | +spec: |
| 221 | + managementState: Managed # <2> |
| 222 | + logStore: |
| 223 | + type: elasticsearch # <3> |
| 224 | + retentionPolicy: # <4> |
| 225 | + application: |
| 226 | + maxAge: 1d |
| 227 | + infra: |
| 228 | + maxAge: 7d |
| 229 | + audit: |
| 230 | + maxAge: 7d |
| 231 | + elasticsearch: |
| 232 | + nodeCount: 3 # <5> |
| 233 | + storage: |
| 234 | + storageClassName: <storage_class_name> # <6> |
| 235 | + size: 200G |
| 236 | + resources: # <7> |
| 237 | + limits: |
| 238 | + memory: 16Gi |
| 239 | + requests: |
| 240 | + memory: 16Gi |
| 241 | + proxy: # <8> |
| 242 | + resources: |
| 243 | + limits: |
| 244 | + memory: 256Mi |
| 245 | + requests: |
| 246 | + memory: 256Mi |
| 247 | + redundancyPolicy: SingleRedundancy |
| 248 | + visualization: |
| 249 | + type: kibana # <9> |
| 250 | + kibana: |
| 251 | + replicas: 1 |
| 252 | + collection: |
| 253 | + type: fluentd # <10> |
| 254 | + fluentd: {} |
| 255 | +---- |
| 256 | +<1> The name must be `instance`. |
| 257 | +<2> The OpenShift Logging management state. In some cases, if you change the OpenShift Logging defaults, you must set this to `Unmanaged`. |
| 258 | +However, an unmanaged deployment does not receive updates until OpenShift Logging is placed back into a managed state. |
| 259 | +<3> Settings for configuring Elasticsearch. Using the CR, you can configure shard replication policy and persistent storage. |
| 260 | +<4> Specify 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. |
| 261 | +<5> Specify the number of Elasticsearch nodes. |
| 262 | +<6> Enter 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. |
| 263 | +<7> Specify 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 `16Gi` for the memory request and `1` for the CPU request. |
| 264 | +<8> Specify 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. |
| 265 | +<9> Settings for configuring Kibana. Using the CR, you can scale Kibana for redundancy and configure the CPU and memory for your Kibana nodes. |
| 266 | +<10> Settings for configuring Fluentd. Using the CR, you can configure Fluentd CPU and memory limits. |
| 267 | +-- |
| 268 | ++ |
| 269 | +[NOTE] |
| 270 | +==== |
| 271 | +The maximum number of master nodes is three. If you specify a `nodeCount` greater than `3`, {product-title} 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. Master 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. |
| 272 | + |
| 273 | +For example, if `nodeCount=4`, the following nodes are created: |
| 274 | + |
| 275 | +[source,terminal] |
| 276 | +---- |
| 277 | +$ oc get deployment |
| 278 | +---- |
| 279 | + |
| 280 | +.Example output |
| 281 | +[source,terminal] |
| 282 | +---- |
| 283 | +cluster-logging-operator-66f77ffccb-ppzbg 1/1 Running 0 7m |
| 284 | +elasticsearch-cdm-ftuhduuw-1-ffc4b9566-q6bhp 2/2 Running 0 2m40s |
| 285 | +elasticsearch-cdm-ftuhduuw-2-7b4994dbfc-rd2gc 2/2 Running 0 2m36s |
| 286 | +elasticsearch-cdm-ftuhduuw-3-84b5ff7ff8-gqnm2 2/2 Running 0 2m4s |
| 287 | +---- |
| 288 | +==== |
| 289 | +
|
| 290 | +. Apply the `ClusterLogging` CR by running the following command: |
| 291 | ++ |
| 292 | +[source,terminal] |
| 293 | +---- |
| 294 | +$ oc apply -f <filename>.yaml |
| 295 | +---- |
| 296 | +
|
| 297 | +. Verify the installation by running the following command: |
| 298 | ++ |
| 299 | +[source,terminal] |
| 300 | +---- |
| 301 | +$ oc get pods -n openshift-logging |
| 302 | +---- |
| 303 | ++ |
| 304 | +.Example output |
| 305 | +[source,terminal] |
| 306 | +---- |
| 307 | +NAME READY STATUS RESTARTS AGE |
| 308 | +cluster-logging-operator-66f77ffccb-ppzbg 1/1 Running 0 7m |
| 309 | +elasticsearch-cdm-ftuhduuw-1-ffc4b9566-q6bhp 2/2 Running 0 2m40s |
| 310 | +elasticsearch-cdm-ftuhduuw-2-7b4994dbfc-rd2gc 2/2 Running 0 2m36s |
| 311 | +elasticsearch-cdm-ftuhduuw-3-84b5ff7ff8-gqnm2 2/2 Running 0 2m4s |
| 312 | +collector-587vb 1/1 Running 0 2m26s |
| 313 | +collector-7mpb9 1/1 Running 0 2m30s |
| 314 | +collector-flm6j 1/1 Running 0 2m33s |
| 315 | +collector-gn4rn 1/1 Running 0 2m26s |
| 316 | +collector-nlgb6 1/1 Running 0 2m30s |
| 317 | +collector-snpkt 1/1 Running 0 2m28s |
| 318 | +kibana-d6d5668c5-rppqm 2/2 Running 0 2m39s |
| 319 | +---- |
0 commit comments