Promtail is distributed as a binary, in a Docker container, or there is a Helm chart to install it in a Kubernetes cluster.
Every release includes binaries for Promtail which can be found on the Releases page.
# modify tag to most recent version docker pull grafana/promtail:2.0.0
Make sure that Helm is installed. See Installing Helm. Then you can add Grafana’s chart repository to Helm:
helm repo add grafana https://grafana.github.io/helm-charts
And the chart repository can be updated by running:
helm repo update
Finally, Promtail can be deployed with:
$ helm upgrade --install promtail grafana/promtail --set "loki.serviceName=loki"
DaemonSet will deploy Promtail on every node within a Kubernetes cluster.
The DaemonSet deployment works well at collecting the logs of all containers within a cluster. It’s the best solution for a single-tenant model.
---Daemonset.yaml apiVersion: apps/v1 kind: DaemonSet metadata: name: promtail-daemonset spec: selector: matchLabels: name: promtail template: metadata: labels: name: promtail spec: serviceAccount: SERVICE_ACCOUNT serviceAccountName: SERVICE_ACCOUNT volumes: - name: logs hostPath: path: HOST_PATH - name: promtail-config configMap: name: promtail-configmap containers: - name: promtail-container image: grafana/promtail args: - -config.file=/etc/promtail/promtail.yaml env: - name: 'HOSTNAME', # needed when using kubernetes_sd_configs valueFrom: fieldRef: fieldPath: 'spec.nodeName' volumeMounts: - name: logs mountPath: MOUNT_PATH - name: promtail-config mountPath: /etc/promtail ---configmap.yaml apiVersion: v1 kind: ConfigMap metadata: name: promtail-config data: promtail.yaml: YOUR CONFIG ---Clusterrole.yaml apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: promtail-clusterrole rules: - apiGroups: [""] resources: - nodes - services - pods verbs: - get - watch - list ---ServiceAccount.yaml apiVersion: v1 kind: ServiceAccount metadata: name: promtail-serviceaccount ---Rolebinding.yaml apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: promtail-clusterrolebinding subjects: - kind: ServiceAccount name: promtail-serviceaccount namespace: default roleRef: kind: ClusterRole name: promtail-clusterrole apiGroup: rbac.authorization.k8s.io
The Sidecar method deploys Promtail as a sidecar container for a specific pod. In a multi-tenant environment, this enables teams to aggregate logs for specific pods and deployments.
---Deployment.yaml apiVersion: apps/v1 kind: Deployment metadata: name: promtail-deployment spec: selector: matchLabels: name: promtail template: metadata: labels: name: promtail spec: serviceAccount: SERVICE_ACCOUNT serviceAccountName: SERVICE_ACCOUNT volumes: - name: logs hostPath: path: HOST_PATH - name: promtail-config configMap: name: promtail-configmap containers: - name: promtail-container image: grafana/promtail args: - -config.file=/etc/promtail/promtail.yaml volumeMounts: - name: logs mountPath: MOUNT_PATH - name: promtail-config mountPath: /etc/promtail
Related Enterprise Logs resources
Grafana Enterprise Logs: Logging with security and scale
Join us for this webinar, which will cover: Challenges with logging as organizations scale and the volume of logs explodes, how Grafana Enterprise Logs enables organizations to make logs available to any team members who need them, features available in GEL and how to get access, a live product demo so you can see GEL for the first time
VIDEO: Watch this first-look demo of the new Grafana Enterprise Logs
Based on Loki, Grafana Enterprise Logs is part of the Grafana Enterprise Stack for composing and scaling observability on your own infrastructure.
Introducing Grafana Enterprise Logs, a core part of the Grafana Enterprise Stack integrated observability solution
Powered by the Loki open source project, the Enterprise Logs offering joins metrics and dashboards in our enterprise-ready stack for self-managed observability.