How to Deploy Sentry in Kubernetes Using Helm

Sentry is an open-source software platform used to track, manage, and correct errors in applications. It operates by collecting information about errors and exceptions that occur in the code and providing an intuitive interface to visualize and analyze these issues.

It is a cross-platform crash reporting and aggregation platform.

In this guire we are going to learn how to set up sentry in kubernetes.

Prerequisites

To follow along, ensure that you have the following

  • Kubernetes Cluster: A running Kubernetes cluster (e.g., Minikube, AKS, EKS, GKE, etc.).
  • kubectl: Installed and configured to connect to your cluster.
  • Helm: Installed and initialized (helm version).
  • Persistent Storage: Ensure your cluster has storage provisioners (e.g., for PostgreSQL).

Assing the Sentry repo

Sentry provides a helm chart that can be used to set it up in kubernetes, located here https://github.com/sentry-kubernetes/charts

Use the following command to add the helm repo

1
helm repo add sentry https://sentry-kubernetes.github.io/charts

Update the helm repo to pull the latest

1
helm repo update

You can confirm the added repo using the search command

1
2
3
4
5
6
7
$ helm search repo sentry

NAME                     CHART VERSION APP VERSION DESCRIPTION
sentry/sentry            26.11.0       24.11.2     A Helm chart for Kubernetes
sentry/sentry-db         0.9.4         10.0.0      A Helm chart for Kubernetes
sentry/sentry-kubernetes 0.4.0         latest      A Helm chart for sentry-kubernetes (https://git...
sentry/clickhouse        3.14.0        23.8.16.16  ClickHouse is an open source column-oriented da...

Create a custom values file

You can download values so you update using this command

Download the default values.yaml to customize the deployment:

1
helm show values sentry/sentry > values.yaml

To customize our installation, we can create a custom values file values.yml with our options. These are some commin options to use:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
user:
  create: true
  email: admin@citizix.com
  password: 'jh7lGQImvDGjxmDHycu2QDfN57'

ingress:
  enabled: true
  regexPathStyle: traefik
  ingressClassName: traefik
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt-prod-issuer
  hostname: sentry.citizix.com
  tls:
  - hosts:
    - sentry.citizix.com
    secretName: sentry-tls

sentry:
  singleOrganization: false
  worker:
    replicas: 1

system:
  url: "https://sentry.citizix.com"
  adminEmail: "admin@citizix.com"
  public: true
  # Only set this key with the sentry secret if upgrading
  # secretKey: "xxx"

mail:
  backend: smtp
  useTls: true
  username: "resend"
  password: "xxx"
  port: 587
  host: "smtp.resend.com"
  from: "devops@citizix.com"

slack:
  clientId: "xxxx.xxxx"
  clientSecret: "xxxx"
  signingSecret: "xxxx"
#   Reference -> https://develop.sentry.dev/integrations/slack/

postgresql:
  enabled: false

## This value is only used when postgresql.enabled is set to false
externalPostgresql:
  host: postgres.postgres
  port: 5432
  username: sentry
  password: "xxx"
  database: sentry

In the above, we have configurations for the following:

  • An admin username and password to login to sentry
  • Ingress to use traefik controller with the target domain on which you can access sentry later
  • Resend as a mail provider
  • Configured slack for issue alert notification, you should create a dedicated slack app to get the mentioned credentials
  • An external Postgres Instance

Edit the values.yaml file to adjust configurations such as:

Deploying Sentry

Create namespace for sentry

1
kubectl create namespace sentry

Run the following command to install it:

1
2
3
4
5
helm install \
  --namespace sentry sentry \
  --version 26.11.0 \
  -f ./value.yml \
  sentry/sentry

Using Helmfile

You can also use helmfile. Helmfile allows you to add helm configuration as code.

Create a file named helmfile.yaml with this content:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
helmDefaults:
  createNamespace: true
  timeout: 1000
  wait: true

repositories:
  - name: sentry
    url: https://sentry-kubernetes.github.io/charts

releases:
  - name: sentry
    namespace: sentry
    chart: sentry/sentry
    version: "26.11.0"
    values:
      - ./values.yml

Then you can confirm the generated yaml templates:

1
helmfile template

Finally apply by doing a sync:

1
helmfile sync

Verify the deployment

Check if pods are running

1
kubectl get pods -n sentry

You should see pods for:

  • Sentry web
  • Sentry worker
  • PostgreSQL
  • Redis
  • Cron jobs

Accessing Sentry

If all goes well, access the sentry using the url defined with the username and password provided.

By default, the Helm chart creates a LoadBalancer service. Get the external IP:

1
kubectl get svc -n sentry

Alternatively, use port-forwarding for local testing:

1
kubectl port-forward -n sentry svc/sentry 9000:9000

Access Sentry at http://localhost:9000.

In our case since we set up an ingress, we can access sentry using that url;

Post-Deployment Setup

  • Open Sentry in your browser and complete the setup wizard.
  • Configure email settings (SMTP) if not already set in values.yaml.
  • Set up organization, projects, and team members.
Last updated on Jan 19, 2025 21:12 +0300
comments powered by Disqus
Citizix Ltd
Built with Hugo
Theme Stack designed by Jimmy