Skip to content
This repository has been archived by the owner on Oct 8, 2024. It is now read-only.
/ promtail-app Public archive
generated from giantswarm/template-app

Promtail - logging agent for Loki

License

Notifications You must be signed in to change notification settings

giantswarm/promtail-app

Repository files navigation

Promtail App

CircleCI

Giant Swarm offers Promtail as a managed app which can be installed in any clusters. It deploys a Promtail agent used to collect and ship logs (through the HTTP protocol) to a private Grafana Loki instance.

Please note that you can run multiple promtail instances on the same cluster (albeit in different namespaces), but it's up to you to provide a reasonable config for them (and ie. avoid duplication of scrapes).

⚠️ Deprecation notice

On most recent releases we use Alloy to collect logs. Promtail is not used anymore, and it is now deprecated.

Table of Contents:

Install

There are several ways to install this app onto a workload cluster.

Upgrading

Upgrading an existing Release to a new major version

A major chart version change (like v0.5.0 -> v1.0.0) indicates that there is an incompatible breaking change needing manual actions.

From 0.x to 1.x

The structure of the values changed in 1.0.0 as we now rely on helm chart dependency mechanism to manage the application.

Before you upgrade, you must edit your values (in both configmaps and secrets) to follow the new structure from:

# old values.yaml structure
resources:
  limits:
    cpu: 200m
    memory: 256Mi
  requests:
    cpu: 100m
    memory: 128Mi

To:

# new values.yaml structure
promtail:
  resources:
    limits:
      cpu: 200m
      memory: 256Mi
    requests:
      cpu: 100m
      memory: 128Mi

As you can see, in the new format, all properties coming from the subchart as described below, must be moved under a promtail: section.

Configuration

By default, Promtail is configured to read logs from all Kubernetes pods and from the systemd-journald logging service running on the machine the agent is deployed on.

As this application is build upon the Grafana promtail upstream chart as a dependency, most of the values to override can be found here.

Examples:

The Giant Swarm default values can also be overriden but we advise against it.

values.yaml

This is an example of a values file you could upload using our web interface.

# values.yaml
promtail:
  resources:
    limits:
      cpu: 200m
      memory: 256Mi
    requests:
      cpu: 100m
      memory: 128Mi

Sample App CR and ConfigMap for the management cluster

If you have access to the Kubernetes API on the management cluster, you could create the App CR and ConfigMap directly.

Here is an example that would install the app to workload cluster abc12:

# appCR.yaml
apiVersion: application.giantswarm.io/v1alpha1
kind: App
metadata:
  labels:
  name: promtail-app
  # workload cluster resources live in a namespace with the same ID as the
  # workload cluster.
  namespace: abc12
spec:
  name: promtail-app
  namespace: promtail
  catalog: giantswarm
  version: 2.2.0
  userConfig:
    configMap:
      name: promtail-app-user-values
      namespace: abc12
# user-values-configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: promtail-app-user-values
  namespace: abc12
data:
  values: |
    promtail:
      # -- Resource requests and limits
      resources:
        limits:
          cpu: 200m
          memory: 256Mi
        requests:
          cpu: 100m
          memory: 128Mi

See our full reference on how to configure apps for more details.

Limitations

The application and its default values have been tailored to work inside Giant Swarm clusters and to connect to our managed Loki app. If you want to use it for any other scenario, know that you might need to adjust some values.

Credit

This application is installing the upstream chart below with defaults to ensure it runs smoothly in Giant Swarm clusters.