DevOps
How to deploy Sentry on a Kubernetes cluster with an external custom ingress
Sentry can be easily installed on a Kubernetes cluster with a few tweaks, here's how.
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
- 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
thenginx.ingress.kubernetes.io/upstream-vhost
annotation might also come in handy. It sets theHost
**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
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 ...
Voilà! You have a fully working Sentry installation.
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!