1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/logging-create-loki-cr-cli.adoc
2024-05-17 18:07:23 +00:00

127 lines
5.4 KiB
Plaintext

// Module included in the following assemblies:
//
// * observability/logging/log_storage/installing-log-storage.adoc
:_mod-docs-content-type: PROCEDURE
[id="logging-create-loki-cr-cli_{context}"]
= Creating a LokiStack custom resource by using the CLI
You can create a `LokiStack` custom resource (CR) by using the {oc-first}.
.Prerequisites
* You have administrator permissions.
* You installed the {loki-op}.
* You installed the {oc-first}.
.Procedure
. Create a `LokiStack` CR:
// tag::pre-5.9[]
+
--
.Example `LokiStack` CR
[source,yaml]
----
apiVersion: loki.grafana.com/v1
kind: LokiStack
metadata:
name: logging-loki
namespace: openshift-logging
spec:
size: 1x.small # <1>
storage:
schemas:
- version: v12
effectiveDate: "2022-06-01"
secret:
name: logging-loki-s3 # <2>
type: s3 # <3>
storageClassName: <storage_class_name> # <4>
tenants:
mode: openshift-logging
----
<1> Specify the deployment size. In the {logging} 5.8 and later versions, the supported size options for production instances of Loki are `1x.extra-small`, `1x.small`, or `1x.medium`.
<2> Specify the name of your log store secret.
<3> Specify the type of your log store secret.
<4> Specify the name of a storage class for temporary storage. For best performance, specify a storage class that allocates block storage. Available storage classes for your cluster can be listed by using the `oc get storageclasses` command.
[IMPORTANT]
====
It is not possible to change the number `1x` for the deployment size.
====
// end::pre-5.9[]
// tag::5.9[]
.Example `LokiStack` CR
[source,yaml]
----
apiVersion: loki.grafana.com/v1
kind: LokiStack
metadata:
name: logging-loki # <1>
namespace: openshift-logging
spec:
size: 1x.small # <2>
storage:
schemas:
- effectiveDate: '2023-10-15'
version: v13
secret:
name: logging-loki-s3 # <3>
type: s3 # <4>
credentialMode: # <5>
storageClassName: <storage_class_name> # <6>
tenants:
mode: openshift-logging
----
<1> Use the name `logging-loki`.
<2> Specify the deployment size. In the {logging} 5.8 and later versions, the supported size options for production instances of Loki are `1x.extra-small`, `1x.small`, or `1x.medium`.
<3> Specify the secret used for your log storage.
<4> Specify the corresponding storage type.
<5> Optional field, {logging} 5.9 and later. Supported user configured values are as follows: `static` is the default authentication mode available for all supported object storage types using credentials stored in a Secret. `token` for short-lived tokens retrieved from a credential source. In this mode the static configuration does not contain credentials needed for the object storage. Instead, they are generated during runtime using a service, which allows for shorter-lived credentials and much more granular control. This authentication mode is not supported for all object storage types. `token-cco` is the default value when Loki is running on managed STS mode and using CCO on STS/WIF clusters.
<6> Enter the name of a storage class for temporary storage. For best performance, specify a storage class that allocates block storage. Available storage classes for your cluster can be listed by using the `oc get storageclasses` command.
// end::5.9[]
. Apply the `LokiStack` CR by running the following command:
.Verification
* Verify the installation by listing the pods in the `openshift-logging` project by running the following command and observing the output:
+
[source,terminal]
----
$ oc get pods -n openshift-logging
----
+
Confirm that you 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-78fddc697-mnl82 1/1 Running 0 14m
collector-6cglq 2/2 Running 0 45s
collector-8r664 2/2 Running 0 45s
collector-8z7px 2/2 Running 0 45s
collector-pdxl9 2/2 Running 0 45s
collector-tc9dx 2/2 Running 0 45s
collector-xkd76 2/2 Running 0 45s
logging-loki-compactor-0 1/1 Running 0 8m2s
logging-loki-distributor-b85b7d9fd-25j9g 1/1 Running 0 8m2s
logging-loki-distributor-b85b7d9fd-xwjs6 1/1 Running 0 8m2s
logging-loki-gateway-7bb86fd855-hjhl4 2/2 Running 0 8m2s
logging-loki-gateway-7bb86fd855-qjtlb 2/2 Running 0 8m2s
logging-loki-index-gateway-0 1/1 Running 0 8m2s
logging-loki-index-gateway-1 1/1 Running 0 7m29s
logging-loki-ingester-0 1/1 Running 0 8m2s
logging-loki-ingester-1 1/1 Running 0 6m46s
logging-loki-querier-f5cf9cb87-9fdjd 1/1 Running 0 8m2s
logging-loki-querier-f5cf9cb87-fp9v5 1/1 Running 0 8m2s
logging-loki-query-frontend-58c579fcb7-lfvbc 1/1 Running 0 8m2s
logging-loki-query-frontend-58c579fcb7-tjf9k 1/1 Running 0 8m2s
logging-view-plugin-79448d8df6-ckgmx 1/1 Running 0 46s
----