You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Terraform module for deploy Loki logging to your kubernetes cluster, with multi cloud storage support.
Wokrflow
Module creates all necessary resources for logging important containers inside your kubernetes cluster. Previously you need to have Grafana to see your logs. Loki is only separate Data Source for Grafana.
Module supports different storages for logs: AWS S3 bucket, GCP GCS Bucket, Azure Blob storage and Kubernetes Persistent Volume.
Software Requirements
Name
Description
Terraform
>= v0.14.9
Helm provider
>= 2.1.0
Kubernetes provider
>= v2.0.1
Usage
AWS with S3 as storage
module "aws_s3_loki_stack" {
source = "terraform-iaac/loki-stack/kubernetes"
# In case if IRSA is enabled. IRSA must have S3 RW Policy access.
# Otherwise, your instance must have S3 RW Policy attached.
loki_service_account_annotations = {
"eks.amazonaws.com/role-arn" = "arn:aws:iam::123456789:role/loki-logging"
}
provider_type = "aws"
s3_name = "s3-bucket-loki-logs"
s3_region = "us-east-1"
}
GCP with GCS as storage
module "gcs_loki_stack" {
source = "terraform-iaac/loki-stack/kubernetes"
# In case if Workload Identity is enabled.
# Otherwise, your node must have RW permissions to GCS.
loki_service_account_annotations = {
"iam.gke.io/gcp-service-account" = "[email protected]"
}
provider_type = "gcp"
gcs_bucket_name = "gcs-bucket-loki-logs"
}
Note: provider_type supports only aws, azure, gcp or local value. Every value require own variables (see locals section in varaibles.tf file or check examples.)
Inputs
Name
Description
Type
Default
Example
Required
namespace
Name of namespace where you want to deploy loki-stack
string
monitoring
n/a
no
create_namespace
Create namespace by module? true or false
bool
true
n/a
no
loki_resources
Compute Resources required by loki container. CPU/RAM requests
map
{ request_cpu = "50m" request_memory = "100Mi" }
{ request_cpu = "20m" request_memory = "50Mi" }
no
promtail_resources
Compute Resources required by promtail container. CPU/RAM requests
map
{ request_cpu = "20m" request_memory = "50Mi" }
{ request_cpu = "20m" request_memory = "50Mi" }
no
Loki variables
Name
Description
Type
Default
Example
Required
loki_name
Loki application name
string
loki
n/a
no
loki_docker_image
Image for Loki container
string
grafana/loki:2.3.0
n/a
no
loki_termination_grace_period_seconds
Grace period applies to the total time it takes for both the PreStop hook to execute and for the Container to stop normally