github.com/yankunsam/loki/v2@v2.6.3-0.20220817130409-389df5235c27/docs/sources/installation/microservices-helm.md (about) 1 --- 2 title: Microservices deployment with Helm 3 weight: 25 4 --- 5 6 # Microservices deployment of Grafana Loki with Helm 7 8 The Helm installation runs the Grafana Loki cluster in 9 [microservices mode](../../fundamentals/architecture/deployment-modes/#microservices-mode) 10 within a Kubernetes cluster. 11 12 ## Prerequisites 13 14 - Helm. See [Installing Helm](https://helm.sh/docs/intro/install/). 15 - A running Kubernetes cluster. 16 17 ## Deploy a Loki 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-distributed 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-distributed 43 ``` 44 45 - Deploy with added custom configuration: 46 47 ```bash 48 helm upgrade --install loki grafana/loki-distributed --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 74 (with `<helm-installation-name>` and `<namespace>` replaced by the installation and namespace, respectively, of your deployment). 75 76 ## Run Loki behind HTTPS Ingress 77 78 If Loki and Promtail are deployed on different clusters, you can add an Ingress 79 in front of Loki. By adding a certificate, you create an HTTPS endpoint. For 80 extra security you can also enable Basic Authentication on Ingress. 81 82 In the Promtail configuration, set the following values to communicate using HTTPS and basic authentication: 83 84 ```yaml 85 loki: 86 serviceScheme: https 87 user: user 88 password: pass 89 ``` 90 91 In the `values.yaml` file you passed to the helm chart, add: 92 93 ```yaml 94 gateway: 95 ingress: 96 enabled: true 97 ``` 98 99 ## Run Promtail with syslog support 100 101 In order to receive and process syslog messages in Promtail, the following changes will be necessary: 102 103 - Review the [Promtail syslog-receiver configuration documentation](../../clients/promtail/scraping/#syslog-receiver) 104 105 - 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: 106 107 ```yaml 108 extraScrapeConfigs: 109 - job_name: syslog 110 syslog: 111 listen_address: 0.0.0.0:1514 112 labels: 113 job: "syslog" 114 relabel_configs: 115 - source_labels: ['__syslog_message_hostname'] 116 target_label: 'host' 117 syslogService: 118 enabled: true 119 type: LoadBalancer 120 port: 1514 121 ``` 122 123 ## Run Promtail with systemd-journal support 124 125 In order to receive and process syslog message into Promtail, the following changes will be necessary: 126 127 - Review the [Promtail systemd-journal configuration documentation](../../clients/promtail/scraping/#journal-scraping-linux-only) 128 129 - 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: 130 131 ```yaml 132 # Add additional scrape config 133 extraScrapeConfigs: 134 - job_name: journal 135 journal: 136 path: /var/log/journal 137 max_age: 12h 138 labels: 139 job: systemd-journal 140 relabel_configs: 141 - source_labels: ['__journal__systemd_unit'] 142 target_label: 'unit' 143 - source_labels: ['__journal__hostname'] 144 target_label: 'hostname' 145 146 # Mount journal directory into Promtail pods 147 extraVolumes: 148 - name: journal 149 hostPath: 150 path: /var/log/journal 151 152 extraVolumeMounts: 153 - name: journal 154 mountPath: /var/log/journal 155 readOnly: true 156 ```