mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-06 06:46:26 +01:00
365 lines
15 KiB
Plaintext
365 lines
15 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * logging/cluster-logging-deploying.adoc
|
|
|
|
:_mod-docs-content-type: PROCEDURE
|
|
[id="cluster-logging-deploy-cli_{context}"]
|
|
= Installing the {logging} using the CLI
|
|
|
|
You can use the {oc-first} to install the {es-op} and the {clo}.
|
|
|
|
.Prerequisites
|
|
|
|
* Ensure that you have the necessary persistent storage for Elasticsearch. Note that each Elasticsearch node requires its own storage volume.
|
|
+
|
|
[NOTE]
|
|
====
|
|
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, {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.
|
|
|
|
ifdef::openshift-origin[]
|
|
* Ensure that you have downloaded the {cluster-manager-url-pull} 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 {product-title} to use Red Hat Operators*.
|
|
endif::[]
|
|
|
|
.Procedure
|
|
|
|
. Create a `Namespace` object for the {es-op}:
|
|
+
|
|
.Example `Namespace` object
|
|
[source,yaml]
|
|
----
|
|
apiVersion: v1
|
|
kind: Namespace
|
|
metadata:
|
|
name: openshift-operators-redhat <1>
|
|
annotations:
|
|
openshift.io/node-selector: ""
|
|
labels:
|
|
openshift.io/cluster-monitoring: "true" <2>
|
|
----
|
|
<1> You 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
|
|
ifdef::openshift-rosa[]
|
|
a ROSA
|
|
endif::[]
|
|
ifdef::openshift-dedicated[]
|
|
an {product-title}
|
|
endif::[]
|
|
metric, which would cause conflicts.
|
|
<2> String. You must specify this label as shown to ensure that cluster monitoring scrapes the `openshift-operators-redhat` namespace.
|
|
|
|
. Apply the `Namespace` object by running the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc apply -f <filename>.yaml
|
|
----
|
|
|
|
. Create a `Namespace` object for the {clo}:
|
|
+
|
|
.Example `Namespace` object
|
|
[source,yaml]
|
|
----
|
|
apiVersion: v1
|
|
kind: Namespace
|
|
metadata:
|
|
name: openshift-logging
|
|
annotations:
|
|
openshift.io/node-selector: ""
|
|
labels:
|
|
openshift.io/cluster-monitoring: "true"
|
|
----
|
|
|
|
. Apply the `Namespace` object by running the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc apply -f <filename>.yaml
|
|
----
|
|
|
|
. Install the {es-op} by creating the following objects:
|
|
|
|
.. Create an `OperatorGroup` object for the {es-op}:
|
|
+
|
|
.Example `OperatorGroup` object
|
|
[source,yaml]
|
|
----
|
|
apiVersion: operators.coreos.com/v1
|
|
kind: OperatorGroup
|
|
metadata:
|
|
name: openshift-operators-redhat
|
|
namespace: openshift-operators-redhat <1>
|
|
spec: {}
|
|
----
|
|
<1> You must specify the `openshift-operators-redhat` namespace.
|
|
|
|
.. Apply the `OperatorGroup` object by running the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc apply -f <filename>.yaml
|
|
----
|
|
|
|
.. Create a `Subscription` object to subscribe a namespace to the {es-op}:
|
|
+
|
|
.Example `Subscription` object
|
|
[source,yaml]
|
|
----
|
|
apiVersion: operators.coreos.com/v1alpha1
|
|
kind: Subscription
|
|
metadata:
|
|
name: elasticsearch-operator
|
|
namespace: openshift-operators-redhat <1>
|
|
spec:
|
|
channel: <channel> <2>
|
|
installPlanApproval: Automatic <3>
|
|
source: redhat-operators <4>
|
|
sourceNamespace: openshift-marketplace
|
|
name: elasticsearch-operator
|
|
----
|
|
<1> You must specify the `openshift-operators-redhat` namespace.
|
|
<2> Specify `stable`, or `stable-y.z` as the channel, where `y` is the major version and `z` is the minor version. See the following note.
|
|
<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.
|
|
<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 created when you configured the Operator Lifecycle Manager (OLM).
|
|
+
|
|
[NOTE]
|
|
====
|
|
Specifying `stable` installs the current version of the latest stable release. Using `stable` with `installPlanApproval: "Automatic"` automatically upgrades your Operators to the latest stable major and minor release.
|
|
|
|
Specifying `stable-y.z` installs the current minor version of a specific major release. Using `stable-y.z` with `installPlanApproval: "Automatic"` automatically upgrades your Operators to the latest stable minor release within the major `y` release.
|
|
====
|
|
|
|
.. Apply the `Subscription` object by running the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc apply -f <filename>.yaml
|
|
----
|
|
+
|
|
The {es-op} is installed to the `openshift-operators-redhat` namespace and copied to each project in the cluster.
|
|
|
|
. Install the {clo} by creating the following objects:
|
|
|
|
.. Create an `OperatorGroup` object for the {clo}:
|
|
+
|
|
.Example `OperatorGroup` object
|
|
[source,yaml]
|
|
----
|
|
apiVersion: operators.coreos.com/v1
|
|
kind: OperatorGroup
|
|
metadata:
|
|
name: cluster-logging
|
|
namespace: openshift-logging <1>
|
|
spec:
|
|
targetNamespaces:
|
|
- openshift-logging <1>
|
|
----
|
|
<1> You must specify the `openshift-logging` namespace.
|
|
|
|
.. Apply the `OperatorGroup` object by running the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc apply -f <filename>.yaml
|
|
----
|
|
|
|
.. Create a `Subscription` object to subscribe a namespace to the {clo}:
|
|
+
|
|
.Example `Subscription` object
|
|
[source,yaml]
|
|
----
|
|
apiVersion: operators.coreos.com/v1alpha1
|
|
kind: Subscription
|
|
metadata:
|
|
name: cluster-logging
|
|
namespace: openshift-logging <1>
|
|
spec:
|
|
channel: "stable" <2>
|
|
name: cluster-logging
|
|
source: redhat-operators <3>
|
|
sourceNamespace: openshift-marketplace
|
|
----
|
|
<1> You must specify the `openshift-logging` namespace.
|
|
<2> Specify `stable`, or `stable-5.<x>` as the channel.
|
|
<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).
|
|
|
|
.. Apply the `Subscription` object by running the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc apply -f <filename>.yaml
|
|
----
|
|
+
|
|
The {clo} is installed to the `openshift-logging` namespace.
|
|
|
|
. Create a `ClusterLogging` custom resource (CR):
|
|
+
|
|
[NOTE]
|
|
====
|
|
This default `ClusterLogging` CR configuration should support a wide array of environments. Review the topics on tuning and configuring {logging} components for information about modifications you can make to the {logging}.
|
|
====
|
|
+
|
|
.Example `ClusterLogging` CR
|
|
[source,yaml]
|
|
----
|
|
apiVersion: logging.openshift.io/v1
|
|
kind: ClusterLogging
|
|
metadata:
|
|
name: instance <1>
|
|
namespace: openshift-logging
|
|
spec:
|
|
managementState: Managed <2>
|
|
logStore:
|
|
type: elasticsearch <3>
|
|
retentionPolicy: <4>
|
|
application:
|
|
maxAge: 1d
|
|
infra:
|
|
maxAge: 7d
|
|
audit:
|
|
maxAge: 7d
|
|
elasticsearch:
|
|
nodeCount: 3 <5>
|
|
storage:
|
|
storageClassName: <storage_class_name> <6>
|
|
size: 200G
|
|
resources: <7>
|
|
limits:
|
|
memory: 16Gi
|
|
requests:
|
|
memory: 16Gi
|
|
proxy: <8>
|
|
resources:
|
|
limits:
|
|
memory: 256Mi
|
|
requests:
|
|
memory: 256Mi
|
|
redundancyPolicy: SingleRedundancy
|
|
visualization:
|
|
type: kibana <9>
|
|
kibana:
|
|
replicas: 1
|
|
collection:
|
|
logs:
|
|
type: fluentd <10>
|
|
fluentd: {}
|
|
----
|
|
<1> The name must be `instance`.
|
|
<2> The {logging} management state. In some cases, if you change the {logging} defaults, you must set this to `Unmanaged`. However, an unmanaged deployment does not receive updates until the {logging} is placed back into a managed state. Placing a deployment back into a managed state might revert any modifications you made.
|
|
<3> Settings for configuring Elasticsearch. Using the custom resource (CR), you can configure shard replication policy and persistent storage.
|
|
<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.
|
|
<5> Specify the number of Elasticsearch nodes. See the note that follows this list.
|
|
<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, {product-title} deploys the {logging} with ephemeral storage only.
|
|
<7> Specify the CPU and memory requests for Elasticsearch as needed. If you leave these values blank, the {es-op} sets default values that are sufficient for most deployments. The default values are `16Gi` for the memory request and `1` for the CPU request.
|
|
<8> Specify the CPU and memory requests for the Elasticsearch proxy as needed. If you leave these values blank, the {es-op} 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.
|
|
<9> Settings for configuring Kibana. Using the CR, you can scale Kibana for redundancy and configure the CPU and memory for your Kibana pods.
|
|
<10> Settings for configuring Fluentd. Using the CR, you can configure Fluentd CPU and memory limits.
|
|
+
|
|
[NOTE]
|
|
+
|
|
====
|
|
The maximum number of Elasticsearch control plane 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. 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:
|
|
|
|
[source,terminal]
|
|
----
|
|
$ oc get deployment
|
|
----
|
|
|
|
.Example output
|
|
[source,terminal]
|
|
----
|
|
cluster-logging-operator 1/1 1 1 18h
|
|
elasticsearch-cd-x6kdekli-1 1/1 1 0 6m54s
|
|
elasticsearch-cdm-x6kdekli-1 1/1 1 1 18h
|
|
elasticsearch-cdm-x6kdekli-2 1/1 1 0 6m49s
|
|
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.
|
|
====
|
|
|
|
. Apply the `ClusterLogging` custom resource (CR) by running the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc apply -f <filename>.yaml
|
|
----
|
|
+
|
|
This creates the {logging} components, the `Elasticsearch` CR and components, and the Kibana interface.
|
|
|
|
.Verification
|
|
|
|
. Verify the {es-op} installation:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc get csv --all-namespaces
|
|
----
|
|
+
|
|
.Example output
|
|
[source,terminal]
|
|
----
|
|
NAMESPACE NAME DISPLAY VERSION REPLACES PHASE
|
|
default elasticsearch-operator.5.1.0-202007012112.p0 OpenShift Elasticsearch Operator 5.5.0-202007012112.p0 Succeeded
|
|
kube-node-lease elasticsearch-operator.5.5.0-202007012112.p0 OpenShift Elasticsearch Operator 5.5.0-202007012112.p0 Succeeded
|
|
kube-public elasticsearch-operator.5.5.0-202007012112.p0 OpenShift Elasticsearch Operator 5.5.0-202007012112.p0 Succeeded
|
|
kube-system elasticsearch-operator.5.5.0-202007012112.p0 OpenShift Elasticsearch Operator 5.5.0-202007012112.p0 Succeeded
|
|
openshift-apiserver-operator elasticsearch-operator.5.5.0-202007012112.p0 OpenShift Elasticsearch Operator 5.5.0-202007012112.p0 Succeeded
|
|
openshift-apiserver elasticsearch-operator.5.5.0-202007012112.p0 OpenShift Elasticsearch Operator 5.5.0-202007012112.p0 Succeeded
|
|
openshift-authentication-operator elasticsearch-operator.5.5.0-202007012112.p0 OpenShift Elasticsearch Operator 5.5.0-202007012112.p0 Succeeded
|
|
openshift-authentication elasticsearch-operator.5.5.0-202007012112.p0 OpenShift Elasticsearch Operator 5.5.0-202007012112.p0 Succeeded
|
|
...
|
|
----
|
|
+
|
|
There should be an {es-op} instance in each namespace. The version number might be different than shown.
|
|
|
|
. Verify the {clo} installation.
|
|
+
|
|
There should be a Red Hat OpenShift Logging Operator in the `openshift-logging` namespace. The Version number might be different than shown.
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc get csv -n openshift-logging
|
|
----
|
|
+
|
|
.Example output
|
|
[source,terminal]
|
|
----
|
|
NAMESPACE NAME DISPLAY VERSION REPLACES PHASE
|
|
...
|
|
openshift-logging clusterlogging.5.1.0-202007012112.p0 OpenShift Logging 5.1.0-202007012112.p0 Succeeded
|
|
...
|
|
----
|
|
|
|
. Verify the installation by listing the pods in the *openshift-logging* project. Run the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc get pods -n openshift-logging
|
|
----
|
|
+
|
|
You should see several pods for components of the {logging}, similar to the following list:
|
|
+
|
|
.Example output
|
|
[source,terminal]
|
|
----
|
|
NAME READY STATUS RESTARTS AGE
|
|
cluster-logging-operator-66f77ffccb-ppzbg 1/1 Running 0 7m
|
|
elasticsearch-cdm-ftuhduuw-1-ffc4b9566-q6bhp 2/2 Running 0 2m40s
|
|
elasticsearch-cdm-ftuhduuw-2-7b4994dbfc-rd2gc 2/2 Running 0 2m36s
|
|
elasticsearch-cdm-ftuhduuw-3-84b5ff7ff8-gqnm2 2/2 Running 0 2m4s
|
|
collector-587vb 1/1 Running 0 2m26s
|
|
collector-7mpb9 1/1 Running 0 2m30s
|
|
collector-flm6j 1/1 Running 0 2m33s
|
|
collector-gn4rn 1/1 Running 0 2m26s
|
|
collector-nlgb6 1/1 Running 0 2m30s
|
|
collector-snpkt 1/1 Running 0 2m28s
|
|
kibana-d6d5668c5-rppqm 2/2 Running 0 2m39s
|
|
----
|