github.com/yankunsam/loki/v2@v2.6.3-0.20220817130409-389df5235c27/docs/sources/installation/simple-scalable-helm.md (about)

     1  ---
     2  title: Simple scalable deployment with Helm
     3  weight: 20
     4  ---
     5  # Simple scalable deployment of Grafana Loki with Helm
     6  
     7  This Helm installation runs the Grafana Loki cluster in
     8  [simple scalable deployment mode](../../fundamentals/architecture/deployment-modes/#simple-scalable-deployment-mode)
     9  within a Kubernetes cluster.
    10  
    11  ## Prerequisites
    12  
    13  - Helm. See [Installing Helm](https://helm.sh/docs/intro/install/).
    14  - A running Kubernetes cluster.
    15  
    16  
    17  ## Deploy Loki to the Kubernetes cluster
    18  
    19  1. Add [Loki's chart repository](https://github.com/grafana/helm-charts) to Helm:
    20  
    21      ```bash
    22      helm repo add grafana https://grafana.github.io/helm-charts
    23      ```
    24  
    25  1. Update the chart repository:
    26  
    27      ```bash
    28      helm repo update
    29      ```
    30  
    31  1. Deploy the Loki cluster using one of these commands.
    32  
    33      - Deploy with the default configuration:
    34  
    35          ```bash
    36          helm upgrade --install loki grafana/loki-simple-scalable
    37          ```
    38  
    39      - Deploy with the default configuration in a custom Kubernetes cluster namespace:
    40  
    41          ```bash
    42          helm upgrade --install loki --namespace=loki grafana/loki-simple-scalable
    43          ```
    44  
    45      - Deploy with added custom configuration:
    46  
    47          ```bash
    48          helm upgrade --install loki grafana/loki-simple-scalable --set "key1=val1,key2=val2,..."
    49          ```
    50  
    51  ## Deploy Grafana to your Kubernetes cluster
    52  
    53  Install Grafana on your Kubernetes cluster with Helm:
    54  
    55  ```bash
    56  helm install loki-grafana grafana/grafana
    57  ```
    58  
    59  To get the admin password for the Grafana pod, run the following command:
    60  
    61  ```bash
    62  kubectl get secret --namespace <YOUR-NAMESPACE> loki-grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo
    63  ```
    64  
    65  To access the Grafana UI, run the following command:
    66  
    67  ```bash
    68  kubectl port-forward --namespace <YOUR-NAMESPACE> service/loki-grafana 3000:80
    69  ```
    70  
    71  Navigate to `http://localhost:3000` and login with `admin` and the password
    72  output above. Then follow the [instructions for adding the Loki Data Source](../../getting-started/grafana/), using the URL
    73  `http://<helm-installation-name>-gateway.<namespace>.svc.cluster.local/` for Loki, with `<helm-installation-name>` and `<namespaced>` replaced with the correct values for your deployment.
    74  
    75  ## Run Loki behind HTTPS Ingress
    76  
    77  If Loki and Promtail are deployed on different clusters, you can add an Ingress
    78  in front of Loki. By adding a certificate, you create an HTTPS endpoint. For
    79  extra security you can also enable Basic Authentication on Ingress.
    80  
    81  In the Promtail configuration, set the following values to communicate using HTTPS and basic authentication:
    82  
    83  ```yaml
    84  loki:
    85    serviceScheme: https
    86    user: user
    87    password: pass
    88  ```
    89  
    90  Sample Helm template for Ingress:
    91  
    92  ```yaml
    93  apiVersion: extensions/v1beta1
    94  kind: Ingress
    95  metadata:
    96    annotations:
    97      kubernetes.io/ingress.class: {{ .Values.ingress.class }}
    98      ingress.kubernetes.io/auth-type: "basic"
    99      ingress.kubernetes.io/auth-secret: {{ .Values.ingress.basic.secret }}
   100    name: loki
   101  spec:
   102    rules:
   103    - host: {{ .Values.ingress.host }}
   104      http:
   105        paths:
   106        - backend:
   107            serviceName: loki
   108            servicePort: 3100
   109    tls:
   110    - secretName: {{ .Values.ingress.cert }}
   111      hosts:
   112      - {{ .Values.ingress.host }}
   113  ```
   114  
   115  ## Run Promtail with syslog support
   116  
   117  In order to receive and process syslog messages in Promtail, the following changes will be necessary:
   118  
   119  * Review the [Promtail syslog-receiver configuration documentation](../../clients/promtail/scraping/#syslog-receiver)
   120  
   121  * Configure the Promtail Helm chart with the syslog configuration added to the `extraScrapeConfigs` section and associated service definition to listen for syslog messages. For example:
   122  
   123      ```yaml
   124      extraScrapeConfigs:
   125        - job_name: syslog
   126          syslog:
   127            listen_address: 0.0.0.0:1514
   128            labels:
   129              job: "syslog"
   130        relabel_configs:
   131          - source_labels: ['__syslog_message_hostname']
   132            target_label: 'host'
   133      syslogService:
   134        enabled: true
   135        type: LoadBalancer
   136        port: 1514
   137      ```
   138  
   139  ## Run Promtail with systemd-journal support
   140  
   141  In order to receive and process syslog message into Promtail, the following changes will be necessary:
   142  
   143  * Review the [Promtail systemd-journal configuration documentation](../../clients/promtail/scraping/#journal-scraping-linux-only)
   144  
   145  * Configure the Promtail Helm chart with the systemd-journal configuration added to the `extraScrapeConfigs` section and volume mounts for the Promtail pods to access the log files. For example:
   146  
   147      ```yaml
   148      # Add additional scrape config
   149      extraScrapeConfigs:
   150        - job_name: journal
   151          journal:
   152            path: /var/log/journal
   153            max_age: 12h
   154            labels:
   155              job: systemd-journal
   156          relabel_configs:
   157            - source_labels: ['__journal__systemd_unit']
   158              target_label: 'unit'
   159            - source_labels: ['__journal__hostname']
   160              target_label: 'hostname'
   161      
   162      # Mount journal directory into Promtail pods
   163      extraVolumes:
   164        - name: journal
   165          hostPath:
   166            path: /var/log/journal
   167      
   168      extraVolumeMounts:
   169        - name: journal
   170          mountPath: /var/log/journal
   171          readOnly: true
   172      ```