Installing Loki
Loki
Getting started
-
If you do not have the Yandex Cloud command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the
--folder-name
or--folder-id
parameter. -
Make sure that the security groups for the Managed Service for Kubernetes cluster and its node groups are configured correctly. If any rule is missing, add it.
Warning
The configuration of security groups determines the performance and availability of the cluster and the services and applications running in it.
-
Prepare for Loki installation:
-
Create a service account with the
storage.uploader
andstorage.viewer
roles. You need it to access Yandex Object Storage. -
Create a static access key for your service account:
-
If you want to install Loki using Yandex Cloud Marketplace, create a static access key in JSON format and save it to the
sa-key.json
file:yc iam access-key create \ --service-account-name=<service_account_name> \ --format=json > sa-key.json
-
If you are going to use a Helm chart to install Loki, run the following command and save the obtained
key_id
andsecret
key:yc iam access-key create \ --service-account-name=<service_account_name>
-
-
Create a bucket with restricted access in Object Storage.
-
Installation using Yandex Cloud Marketplace
-
Go to the folder page
and select Managed Service for Kubernetes. -
Click the name of the Managed Service for Kubernetes cluster you need and select the
Marketplace tab. -
Under Application available for installation, select Loki and click Go to install.
-
Configure the application:
- Namespace: Select or create a namespace for Loki.
- Application name: Specify the app name.
- Bucket name: Specify the name of the bucket in Object Storage.
- Static access key: Paste the contents of the
sa-key.json
file. - Install Promtail: Leave the option enabled to deliver local logs to the Grafana Loki instance using the Promtail agent
. This agent is usually used for applications that require regular monitoring.
-
Click Install.
-
Wait for the application to change its status to
Deployed
. -
Once deployed, Loki is available within the Managed Service for Kubernetes cluster at
http://loki-gateway.<namespace>.svc.cluster.local
.
Installation using a Helm chart
-
Install Helm
v3.8.0 or higher. -
Install kubectl
and configure it to work with the created cluster. -
To install a Helm chart
with Loki, run the following command:helm pull oci://cr.yandex/yc-marketplace/yandex-cloud/grafana/loki/chart/loki \ --version 1.2.0-7 \ --untar && \ helm install \ --namespace <namespace> \ --create-namespace \ --set loki-distributed.loki.storageConfig.aws.bucketnames=<Object_Storage_bucket_name> \ --set loki-distributed.serviceaccountawskeyvalue_generated.accessKeyID=<service_account_key_ID> \ --set loki-distributed.serviceaccountawskeyvalue_generated.secretAccessKey=<service_account_secret_key> \ loki ./loki/
Note
If you are using a Helm version below 3.8.0, append the
export HELM_EXPERIMENTAL_OCI=1 && \
string to the command to enable Open Container Initiative (OCI) support in the Helm client.