1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-06 15:46:57 +01:00
Files
openshift-docs/modules/cluster-logging-deploy-eo-cli.adoc
2020-04-24 20:00:23 +00:00

203 lines
6.5 KiB
Plaintext

// Module included in the following assemblies:
//
// * logging/cluster-logging-deploying.adoc
[id="cluster-logging-deploy-eo-cli_{context}"]
= Install the Elasticsearch Operator using the CLI
You *must* install the Elasticsearch Operator using the CLI following the directions below.
.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. Each Elasticsearch node needs 16G of memory for both memory requests and limits.
The initial set of {product-title} nodes might not be large enough to support the Elasticsearch cluster. You must add additional nodes to the
{product-title} cluster to run with the recommended or higher memory. Each Elasticsearch node can operate with a lower
memory setting though this is not recommended for production deployments.
.Procedure
To install the Elasticsearch Operator using the CLI:
. Create a Namespace for the Elasticsearch Operator.
.. Create a Namespace object YAML file (for example, `eo-namespace.yaml`) for the Elasticsearch Operator:
+
[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 an {product-title} metric, which would cause
conflicts.
<2> You must specify this label as shown to ensure that cluster monitoring
scrapes the `openshift-operators-redhat` Namespace.
.. Create the Namespace:
+
----
$ oc create -f <file-name>.yaml
----
+
For example:
+
----
$ oc create -f eo-namespace.yaml
----
. Install the Elasticsearch Operator by creating the following objects:
.. Create an Operator Group object YAML file (for example, `eo-og.yaml`) for the Elasticsearch operator:
+
[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.
.. Create an Operator Group object:
+
----
$ oc create -f <file-name>.yaml
----
+
For example:
+
----
$ oc create -f eo-og.yaml
----
.. Create a Subscription object YAML file (for example, `eo-sub.yaml`) to
subscribe a Namespace to an Operator.
+
.Example Subscription
[source,yaml]
----
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: "elasticsearch-operator"
namespace: "openshift-operators-redhat" <1>
spec:
channel: "4.4" <2>
installPlanApproval: "Automatic"
source: "redhat-operators" <3>
sourceNamespace: "openshift-marketplace"
name: "elasticsearch-operator"
----
<1> You must specify the `openshift-operators-redhat` Namespace.
<2> Specify `4.4` 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 created when you configured the Operator Lifecycle Manager (OLM).
.. Create the Subscription object:
+
----
$ oc create -f <file-name>.yaml
----
+
For example:
+
----
$ oc create -f eo-sub.yaml
----
.. Change to the `openshift-operators-redhat` project:
+
----
$ oc project openshift-operators-redhat
Now using project "openshift-operators-redhat"
----
.. Create a Role-based Access Control (RBAC) object file (for example, `eo-rbac.yaml`) to grant Prometheus permission to access the `openshift-operators-redhat` Namespace:
+
[source,yaml]
----
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: prometheus-k8s
namespace: openshift-operators-redhat
rules:
- apiGroups:
- ""
resources:
- services
- endpoints
- pods
verbs:
- get
- list
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: prometheus-k8s
namespace: openshift-operators-redhat
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: prometheus-k8s
subjects:
- kind: ServiceAccount
name: prometheus-k8s
namespace: openshift-operators-redhat
----
.. Create the RBAC object:
+
----
$ oc create -f <file-name>.yaml
----
+
For example:
+
----
$ oc create -f eo-rbac.yaml
----
+
The Elasticsearch Operator is installed to the `openshift-operators-redhat` Namespace and copied to each project in the cluster.
. Verify the Operator installation:
+
----
oc get csv --all-namespaces
NAMESPACE NAME DISPLAY VERSION REPLACES PHASE
default elasticsearch-operator.4.4.0-202004222248 Elasticsearch Operator 4.4.0-202004222248 Succeeded
kube-node-lease elasticsearch-operator.4.4.0-202004222248 Elasticsearch Operator 4.4.0-202004222248 Succeeded
kube-public elasticsearch-operator.4.4.0-202004222248 Elasticsearch Operator 4.4.0-202004222248 Succeeded
kube-system elasticsearch-operator.4.4.0-202004222248 Elasticsearch Operator 4.4.0-202004222248 Succeeded
openshift-apiserver-operator elasticsearch-operator.4.4.0-202004222248 Elasticsearch Operator 4.4.0-202004222248 Succeeded
openshift-apiserver elasticsearch-operator.4.4.0-202004222248 Elasticsearch Operator 4.4.0-202004222248 Succeeded
openshift-authentication-operator elasticsearch-operator.4.4.0-202004222248 Elasticsearch Operator 4.4.0-202004222248 Succeeded
openshift-authentication elasticsearch-operator.4.4.0-202004222248 Elasticsearch Operator 4.4.0-202004222248 Succeeded
...
----
+
There should be an Elasticsearch Operator in each Namespace. The version number might be different than shown.
.Next step
Install the Cluster Logging Operator using the Console or the CLI using the steps in the following sections.