2020-02-13 18:30:52 -05:00
// Module included in the following assemblies:
//
2024-04-18 15:46:31 +05:30
// * observability/logging/cluster-logging-deploying.adoc
2020-02-13 18:30:52 -05:00
2023-10-30 10:13:25 -04:00
:_mod-docs-content-type: PROCEDURE
2020-05-08 14:37:10 -04:00
[id="cluster-logging-deploy-cli_{context}"]
2023-11-06 14:34:21 -06:00
= Installing the {clo} by using the CLI
2020-02-13 18:30:52 -05:00
2023-11-06 14:34:21 -06:00
You can use the {oc-first} to install the {clo}.
2020-05-08 14:37:10 -04:00
.Prerequisites
2021-01-22 23:08:58 -05:00
ifdef::openshift-origin[]
2022-01-26 12:04:55 -05:00
* Ensure that you have downloaded the {cluster-manager-url-pull} as shown in _Obtaining the installation program_ in the installation documentation for your platform.
2021-01-22 23:08:58 -05:00
+
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::[]
2023-11-06 14:34:21 -06:00
* You have administrator permissions.
* You have installed the {oc-first}.
2020-02-13 18:30:52 -05:00
2023-11-06 14:34:21 -06:00
.Procedure
2020-02-13 18:30:52 -05:00
2023-11-06 14:34:21 -06:00
. Create a `Namespace` object as a YAML file:
2020-02-13 18:30:52 -05:00
+
2023-11-14 11:06:52 -06:00
.Example `Namespace` object
2020-02-13 18:30:52 -05:00
[source,yaml]
----
apiVersion: v1
kind: Namespace
metadata:
2023-11-06 14:34:21 -06:00
name: <name> <1>
2020-02-13 18:30:52 -05:00
annotations:
openshift.io/node-selector: ""
labels:
openshift.io/cluster-monitoring: "true"
----
2023-11-06 14:34:21 -06:00
<1> You must specify `openshift-logging` as the name of the namespace for logging versions 5.7 and earlier versions. For logging 5.8 and later versions, you can use any name.
2020-02-13 18:30:52 -05:00
2023-11-14 11:06:52 -06:00
. Apply the `Namespace` object by running the following command:
2020-02-13 18:30:52 -05:00
+
2020-08-07 15:42:21 -04:00
[source,terminal]
2020-02-13 18:30:52 -05:00
----
2023-11-14 11:06:52 -06:00
$ oc apply -f <filename>.yaml
2020-02-13 18:30:52 -05:00
----
2023-11-06 14:34:21 -06:00
. Create an `OperatorGroup` object as a YAML file:
2020-02-13 18:30:52 -05:00
+
2023-11-14 11:06:52 -06:00
.Example `OperatorGroup` object
2020-02-13 18:30:52 -05:00
[source,yaml]
----
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
name: cluster-logging
namespace: openshift-logging <1>
spec:
2024-05-08 16:45:31 +05:30
targetNamespaces: [ ] <2>
2020-02-13 18:30:52 -05:00
----
2024-05-08 16:45:31 +05:30
<1> Ensure that the `namespace` field is set to `openshift-logging`.
<2> For logging versions 5.7 and earlier, set `targetNamespaces` to `openshift-logging`. For logging versions 5.8 and later, the default installation mode is all namespaces on the cluster, or specify a list of namespaces separated by a comma.
2020-02-13 18:30:52 -05:00
2023-11-06 14:34:21 -06:00
. Apply the `OperatorGroup` object by running the following command:
2020-02-13 18:30:52 -05:00
+
2020-08-07 15:42:21 -04:00
[source,terminal]
2020-02-13 18:30:52 -05:00
----
2023-11-14 11:06:52 -06:00
$ oc apply -f <filename>.yaml
2020-02-13 18:30:52 -05:00
----
2023-11-06 14:34:21 -06:00
. Create a `Subscription` object to subscribe the namespace to the {clo}:
2020-02-13 18:30:52 -05:00
+
2023-11-14 11:06:52 -06:00
.Example `Subscription` object
2020-08-07 15:42:21 -04:00
[source,yaml]
2020-02-13 18:30:52 -05:00
----
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: cluster-logging
2020-06-08 21:55:44 -04:00
namespace: openshift-logging <1>
2020-02-13 18:30:52 -05:00
spec:
2023-11-06 14:34:21 -06:00
channel: stable <2>
2020-04-23 16:46:50 -04:00
name: cluster-logging
2020-06-08 21:55:44 -04:00
source: redhat-operators <3>
2020-02-13 18:30:52 -05:00
sourceNamespace: openshift-marketplace
----
2023-11-06 14:34:21 -06:00
<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.
<2> Specify `stable` or `stable-x.y` 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).
2020-02-13 18:30:52 -05:00
2023-11-06 14:34:21 -06:00
. Apply the subscription by running the following command:
2020-02-13 18:30:52 -05:00
+
2020-08-07 15:42:21 -04:00
[source,terminal]
2020-02-13 18:30:52 -05:00
----
2023-11-14 11:06:52 -06:00
$ oc apply -f <filename>.yaml
2020-07-06 11:12:15 -04:00
----
2023-12-07 14:03:29 -06:00
+
The {clo} is installed to the `openshift-logging` namespace.
2023-11-14 11:06:52 -06:00
.Verification
2023-11-06 14:34:21 -06:00
. Run the following command:
2020-02-13 18:30:52 -05:00
+
2020-08-07 15:42:21 -04:00
[source,terminal]
2020-02-13 18:30:52 -05:00
----
2023-11-06 14:34:21 -06:00
$ oc get csv -n <namespace>
2020-02-13 18:30:52 -05:00
----
2023-11-06 14:34:21 -06:00
. Observe the output and confirm that the {clo} exists in the namespace:
2020-02-13 18:30:52 -05:00
+
2023-11-14 11:06:52 -06:00
.Example output
[source,terminal]
----
2023-11-06 14:34:21 -06:00
NAMESPACE NAME DISPLAY VERSION REPLACES PHASE
2023-11-14 11:06:52 -06:00
...
2023-11-06 14:34:21 -06:00
openshift-logging clusterlogging.5.8.0-202007012112.p0 OpenShift Logging 5.8.0-202007012112.p0 Succeeded
2023-11-14 11:06:52 -06:00
...
----