DEV Community

Aboubacar Doucoure
Aboubacar Doucoure

Posted on • Edited on

How to deploy Sentry on a Kubernetes cluster with an external custom ingress

Context

Sentry can be installed on a Kubernetes cluster with the help of the official Sentry Helm chart. Here's how.

Sentry is a developer-first error tracking and performance monitoring platform that helps developers see what actually matters, solve quicker, and learn continuously about their applications.

Pre-requisites

  • A working Kubernetes installation
  • A distributed block storage for Kubernetes (I am using Longhorn on Rancher)
  • Cert-manager or equivalent
  • Nginx or equivalent
  • A working helm tooling

Custom ingress

I could not make the included ingress configuration work. Here's a custom ingress that targets the -sentry-web service to the outside world.

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: "{{ .Release.Name }}-sentry"
  annotations:
    nginx.ingress.kubernetes.io/use-regex: "true"  
spec:
  tls:
  - hosts:  
    - sentry.mywebsite.dev  
    secretName: "sentry.mywebsite.dev-tls"
  rules:
  - host: sentry.mywebsite.dev
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: "{{ .Release.Name }}-sentry-web"
            port: 
              number: 9000
Enter fullscreen mode Exit fullscreen mode
  • Add "nginx.ingress.kubernetes.io/use-regex: "true"" as per the official Sentry documentation:

Note: if you are using NGINX Ingress, please set this annotation on your ingress : nginx.ingress.kubernetes.io/use-regex: "true". If you are using** additionalHostNames the nginx.ingress.kubernetes.io/upstream-vhostannotation might also come in handy. It sets the Host **header to the value you provide to avoid CSRF issues.

Install sentry

These are the helm chart values needed to kickstart the sentry installation:

  kafka:
    enabled: true
  user:
    create: true
    email: <REDACTED>
    password: <REDACTED>
  asHook: true
  sentry:
    singleOrganization: false
    worker:
      replicas: 2  
  auth:
    register: false
  hooks:
    activeDeadlineSeconds: 6500
  ingress:
    enabled: false  
  nginx:
    enabled: false
  clickhouse:
    enabled: true
    clickhouse:
      replicas: "1"  
  postgresql:
    enabled: true  
Enter fullscreen mode Exit fullscreen mode

Bonus: use sentry in a helm chart

Most of the examples in this tutorial were made for a custom tooling chart that includes sentry. Here's the sentry version and the repository used:

...
- name: sentry
    alias: sentry
    version: 23.x
    repository: https://sentry-kubernetes.github.io/charts
    condition: sentry.enabled
...
Enter fullscreen mode Exit fullscreen mode

Voilà! You have a fully working Sentry installation.

A capture of the Sentry home screen

Consumption

Here's a quick Loki view at how much Sentry consumes of my cluster's resource with no app being monitored.

I will not provide the exact details of every measurement as the cluster's name is redacted, but as you can see, Sentry taxes a heavy toll on the cluster's resources. At rest it takes up to 13Gb of RAM!

Inspirations and references

Top comments (0)