How to Deploy Sentry for Real‑Time Error Tracking on Kubernetes with Helm
This article explains what an error‑tracking system is, introduces Sentry, and provides a step‑by‑step guide to deploying Sentry on Kubernetes using Helm, OpenEBS storage, PostgreSQL, and configuring projects and alerts for effective monitoring.
Error Tracking System Overview
An error‑tracking system records and follows application errors and exceptions, helping developers and operators locate bugs faster than waiting for user reports.
What Is Sentry?
Sentry is a cross‑platform error‑tracking platform focused on real‑time error reporting.
When an application integrates Sentry’s SDK, errors are sent to Sentry’s server, which processes them via a web component, queues them in a message queue or Redis, and workers consume the data for further handling.
Beautiful web UI
Supports almost all mainstream language SDKs with simple integration
Provides complete error details
Unified error aggregation and analysis
Dashboard, monitoring, and alerting features
Team and member management
Log auditing
Drawbacks include the need for many middleware components (Kafka, RabbitMQ, Redis, PostgreSQL, etc.), which increase deployment cost, though these can be mitigated.
Deploying Sentry
Sentry can be used as a SaaS service or self‑hosted. The following sections describe a self‑hosted deployment on Kubernetes.
Environment
Kubernetes: 1.17.17
Docker: 18.09.0
Helm: 3.6.3
Storage: Local PV
OpenEBS Introduction
OpenEBS is a container‑native block storage solution written in Go, enabling reliable persistent storage for containerized workloads.
Cross‑node data persistence
Cross‑zone and multi‑cloud data sync
Scalable block storage using commodity hardware
Integration with orchestration engines for automatic configuration
QoS guarantees based on CloudByte experience
OpenEBS architecture consists of a data plane (provides storage to applications) and a control plane (manages OpenEBS volume containers).
Deploy OpenEBS
OpenEBS can be installed via Helm chart or Operator.
<code>helm repo add openebs https://openebs.github.io/charts
helm repo update
helm install openebs --namespace openebs openebs/openebs --create-namespace</code> <code>kubectl apply -f https://openebs.github.io/charts/openebs-operator.yaml</code>After installation the following Pods appear:
<code># kubectl get pod -n openebs
NAME READY STATUS RESTARTS AGE
maya-apiserver-67b5b5c858-4mstb 1/1 Running 0 5d19h
openebs-admission-server-6bdf9b76d6-r4r6b 1/1 Running 0 5d19h
openebs-localpv-provisioner-966d864cd-sf8fp 1/1 Running 0 5d19h
... (other pods omitted for brevity)</code>Corresponding StorageClass objects:
<code># kubectl get sc | grep openebs
local (default) openebs.io/local Delete WaitForFirstConsumer false 5d19h
openebs-device openebs.io/local Delete WaitForFirstConsumer false 5d19h
openebs-hostpath openebs.io/local Delete WaitForFirstConsumer false 5d19h
openebs-jiva-default openebs.io/provisioner-iscsi Delete Immediate false 5d19h
openebs-snapshot-promoter volumesnapshot.external-storage.k8s.io/snapshot-promoter Delete Immediate false 5d19h</code>Deploy PostgreSQL
Although Sentry’s chart includes PostgreSQL, a separate deployment is shown to avoid authentication failures such as:
<code>FATAL: password authentication failed for user "postgres"</code>Deploy PostgreSQL using the Bitnami chart:
<code># Add Helm repo
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
# Pull chart
helm pull bitnami/postgresql</code>Create a values file (my-value.yaml):
<code>global:
postgresql:
postgresqlDatabase: "sentry"
postgresqlUsername: "postgres"
existingSecret: ""
postgresqlPassword: "postgres"
servicePort: ""
replicationPassword: ""</code> <code>helm install postgresql -n sentry -f my-value.yaml bitnami/postgresql</code>Resulting Pod:
<code># kubectl get po -n sentry
NAME READY STATUS RESTARTS AGE
postgresql-postgresql-0 1/1 Running 0 3h39m</code>Deploy Sentry
Sentry is also installed via Helm chart.
<code># Add Helm repo
helm repo add sentry https://sentry-kubernetes.github.io/charts
helm repo update
helm search repo sentry
# Pull chart for inspection
helm pull sentry/sentry</code>Create a values file (my-value.yaml):
<code>externalPostgresql:
database: sentry
port: 5432
username: postgres
host: postgresql
password: postgres
postgresql:
enabled: false
mail:
backend: dummy
from: "[email protected]"
host: "smtp"
password: "UZKSGLFEANWGLZNT"
port: 465
useTls: true
username: ""
user:
create: true
email: [email protected]
password: P@ssword
</code> <code>helm install sentry -n sentry -f my-value.yaml sentry/sentry</code>Pods created after deployment:
<code># kubectl get po -n sentry
NAME READY STATUS RESTARTS AGE
sentry-clickhouse-0 1/1 Running 0 3h50m
sentry-clickhouse-1 1/1 Running 0 3h50m
sentry-clickhouse-2 1/1 Running 0 3h50m
sentry-cron-578647dd7-gk7gf 1/1 Running 0 3h50m
sentry-ingest-consumer-... 1/1 Running 0 3h47m
... (other pods omitted for brevity)</code>Access the UI via Ingress or NodePort using the credentials
[email protected]and
P@ssword.
Create a Project
In the Sentry web UI create a new project (e.g., a Go project). The UI provides a DSN and a sample SDK initialization.
<code>package main
import (
"fmt"
"github.com/getsentry/sentry-go"
sentrygin "github.com/getsentry/sentry-go/gin"
"github.com/gin-gonic/gin"
"github.com/pkg/errors"
"net/http"
)
func main() {
if err := sentry.Init(sentry.ClientOptions{Dsn: "https://[email protected]/5942245"}); err != nil {
fmt.Printf("Sentry initialization failed: %v\n", err)
}
sentry.CaptureMessage("It works!")
sentry.CaptureException(errors.New("error msg"))
app := gin.Default()
app.Use(sentrygin.New(sentrygin.Options{}))
app.GET("/", func(ctx *gin.Context) {
ctx.String(http.StatusOK, "Hello world!")
})
app.Run(":3000")
}
</code>General steps for any language: create a project in the UI, obtain the DSN, and add the SDK initialization code to the application.
Create Alerts
Sentry supports a variety of alert types; rules can be defined through the UI to trigger notifications based on error rates, performance issues, etc.
References:
[1] https://sentry.io/
[2] https://openebs.io/
[3] https://github.com/getsentry/sentry
[4] https://github.com/sentry-kubernetes/charts
Ops Development Stories
Maintained by a like‑minded team, covering both operations and development. Topics span Linux ops, DevOps toolchain, Kubernetes containerization, monitoring, log collection, network security, and Python or Go development. Team members: Qiao Ke, wanger, Dong Ge, Su Xin, Hua Zai, Zheng Ge, Teacher Xia.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.