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
|
|
Update the helm repo to pull the latest
|
|
You can confirm the added repo using the search command
|
|
Create a custom values file
You can download values so you update using this command
Download the default values.yaml to customize the deployment:
|
|
To customize our installation, we can create a custom values file values.yml
with our options. These are some commin options to use:
|
|
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
|
|
Run the following command to install it:
|
|
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:
|
|
Then you can confirm the generated yaml templates:
|
|
Finally apply by doing a sync:
|
|
Verify the deployment
Check if pods are running
|
|
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:
|
|
Alternatively, use port-forwarding for local testing:
|
|
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.