Chapter 5. Installing the Loki Operator
The Loki Operator deploys and manages a LokiStack instance that serves as the log store for logging. You can install the Loki Operator by using the OpenShift CLI (oc) or the OpenShift Container Platform web console.
5.1. Loki deployment sizing Copy linkLink copied to clipboard!
Sizing for Loki follows the format of 1x.<size> where the value 1x is number of instances and <size> specifies performance capabilities.
It is not possible to change the number 1x for the deployment size.
| 1x.demo | 1x.extra-small | 1x.small | 1x.medium | |
|---|---|---|---|---|
| Data transfer | Demo use only | 100GB/day | 500GB/day | 2TB/day |
| Queries per second (QPS) | Demo use only | 1-25 QPS at 200ms | 25-50 QPS at 200ms | 25-75 QPS at 200ms |
| Replication factor | None | 2 | 2 | 2 |
| Total CPU requests | None | 14 vCPUs | 34 vCPUs | 54 vCPUs |
| Total memory requests | None | 31Gi | 67Gi | 139Gi |
| Total disk requests | 40Gi | 430Gi | 430Gi | 590Gi |
5.2. Loki object storage Copy linkLink copied to clipboard!
The Loki Operator supports AWS S3 and other S3-compatible object stores such as S3 Compatible storage (NetApp StorageGRID and others) and OpenShift Data Foundation. Azure, Google Cloud Storage (GCS), and Swift are also supported.
The recommended nomenclature for Loki storage is logging-loki-<your_storage_provider>.
The following table shows the type values within the LokiStack custom resource (CR) for each storage provider. For detailed configuration instructions for each provider, see Configuring object storage for LokiStack.
| Storage provider | Secret type value |
|---|---|
| AWS | s3 |
| Azure | azure |
| Google Cloud | gcs |
| S3 Compatible storage | s3 |
| OpenShift Data Foundation | s3 |
| Swift | swift |
5.3. Installing the Loki Operator by using the CLI Copy linkLink copied to clipboard!
Install the Loki Operator to manage the LokiStack log store by using the OpenShift CLI (oc).
Prerequisites
- You have administrator permissions.
-
You have installed the OpenShift CLI (
oc). - You have access to a supported object store.
Procedure
Create a
Namespaceobject for the Loki Operator:apiVersion: v1 kind: Namespace metadata: name: openshift-operators-redhat labels: openshift.io/cluster-monitoring: "true"metadata.name-
You must specify
openshift-operators-redhatas the namespace for the Loki Operator. Theopenshift-operatorsnamespace might contain community Operators, which are untrusted and could publish metrics with the same name as OpenShift Container Platform metrics, causing conflicts. metadata.labels."openshift.io/cluster-monitoring"- A string value that enables cluster monitoring to scrape this namespace.
Apply the
Namespaceobject by running the following command:$ oc apply -f <filename>.yamlCreate an
OperatorGroupobject:apiVersion: operators.coreos.com/v1 kind: OperatorGroup metadata: name: loki-operator namespace: openshift-operators-redhat spec: upgradeStrategy: DefaultApply the
OperatorGroupobject by running the following command:$ oc apply -f <filename>.yamlCreate a
Subscriptionobject for the Loki Operator:apiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: name: loki-operator namespace: openshift-operators-redhat spec: channel: stable-6.5 installPlanApproval: Automatic name: loki-operator source: redhat-operators sourceNamespace: openshift-marketplacespec.channel-
Specify
stable-6.5as the channel. spec.installPlanApproval-
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 toManual, you must manually approve pending updates. spec.sourceSpecify
redhat-operatorsas the value. If your OpenShift Container Platform cluster is installed on a restricted network, also known as a disconnected cluster, specify the name of theCatalogSourceobject that you created when you configured Operator Lifecycle Manager (OLM).WarningA community
loki-operatorpackage also exists in thecommunity-operatorscatalog source. You must specifyredhat-operatorsto install the supported Red Hat version. Using the wrong source installs the upstream community version with different channel names.
Apply the
Subscriptionobject by running the following command:$ oc apply -f <filename>.yamlVerify that the operator installed successfully by running the following command:
$ oc get csv -n openshift-operators-redhatYou get an output similar to the following example:
NAME DISPLAY VERSION PHASE loki-operator.v6.5.0 Loki Operator 6.5.0 Succeeded
5.4. Installing the Loki Operator by using the web console Copy linkLink copied to clipboard!
Install the Loki Operator to manage the LokiStack log store from the OperatorHub by using the OpenShift Container Platform web console.
Prerequisites
- You have administrator permissions.
- You have access to the OpenShift Container Platform web console.
- You have access to a supported object store (AWS S3, GCP, Azure, S3 Compatible storage, OpenShift Data Foundation, or Swift).
Procedure
In the OpenShift Container Platform web console Administrator perspective:
-
For OpenShift Container Platform 4.19 or earlier, click Operators
OperatorHub. -
For OpenShift Container Platform 4.20 or later, click Ecosystem
Software Catalog.
-
For OpenShift Container Platform 4.19 or earlier, click Operators
Type Loki Operator in the Filter by keyword field. Click Loki Operator in the list of available Operators, and then click Install.
ImportantThe Community Loki Operator is not supported by Red Hat. Select the operator provided by Red Hat.
Select stable-6.5 as the Update channel.
The Loki Operator must be deployed to the global Operator group namespace
openshift-operators-redhat, so the Installation mode and Installed Namespace are already selected. If this namespace does not already exist, it is created for you.Select Enable Operator-recommended cluster monitoring on this namespace.
This option sets the
openshift.io/cluster-monitoring: "true"label in theNamespaceobject. You must select this option to ensure that cluster monitoring scrapes theopenshift-operators-redhatnamespace.For Update approval select Automatic, then click Install.
NoteAn Operator might display a
Failedstatus before the installation completes. If the Operator installation completes with anInstallSucceededmessage, refresh the page.
Verification
- Navigate to the Installed Operators page.
- Verify that the Loki Operator displays with a Status of Succeeded.
5.5. Creating the openshift-logging namespace Copy linkLink copied to clipboard!
The LokiStack instance and all logging workloads run in the openshift-logging namespace. Create this namespace if it does not already exist.
Procedure
Create a
Namespaceobject:apiVersion: v1 kind: Namespace metadata: name: openshift-logging labels: openshift.io/cluster-monitoring: "true"metadata.name-
The
openshift-loggingnamespace is dedicated for all logging workloads. metadata.labels."openshift.io/cluster-monitoring"- A string value that enables cluster monitoring to scrape this namespace.
Apply the
Namespaceobject by running the following command:$ oc apply -f <filename>.yaml
5.6. Creating the object storage secret Copy linkLink copied to clipboard!
Create a secret with the credentials for your S3-compatible object store. The Loki Operator requires this secret to configure the LokiStack to store log data.
Procedure
Create a
Secretobject with your object storage credentials. For provider-specific parameters, see the storage configuration documentation.Example
Secretobject for AWS S3apiVersion: v1 kind: Secret metadata: name: logging-loki-s3 namespace: openshift-logging stringData: access_key_id: <your_access_key_id> access_key_secret: <your_secret_access_key> bucketnames: <your_bucket_name> endpoint: <your_s3_endpoint> region: <your_region>metadata.name-
Use the name
logging-loki-s3to match the reference in theLokiStackCR. metadata.namespace-
You must create this secret in the
openshift-loggingnamespace. access_key_id- Your S3 access key ID.
access_key_secret- Your S3 secret access key.
bucketnames-
The name of a pre-created S3 bucket, for example
loki. endpoint-
The full endpoint URL. For AWS:
https://s3.<region>.amazonaws.com. For S3 Compatible storage:https://s3.example.com:9000. regionThe S3 region, for example
us-east-1.NoteThe field names
access_key_id,access_key_secret,bucketnames, andendpointare specific to the Loki Operator. They do not match the standard AWS SDK environment variable names.
Apply the
Secretobject by running the following command:$ oc apply -f <filename>.yaml
5.7. Troubleshooting the Loki Operator installation Copy linkLink copied to clipboard!
The following table lists common issues that you might encounter when installing the Loki Operator and their solutions.
| Symptom | Solution |
|---|---|
|
|
Verify the channel name and source. Run |