New to KubeDB? Please start here.
MSSQLServer Grafana Dashboard
KubeDB exposes MSSQLServer metrics through a sidecar exporter, and its own view of each resource (status, phase, version) through Panopticon. Once Prometheus is scraping both, you can visualize them in Grafana using pre-built KubeDB dashboards. This tutorial walks through the full setup: deploying the monitoring stack, enabling monitoring on a MSSQLServer instance, and importing the Grafana dashboards.
Before You Begin
You need a Kubernetes cluster with
kubectlconfigured. If you do not already have a cluster, you can create one by using kind.KubeDB must be installed in your cluster with
kubedb-metricsenabled. Follow the setup guide here and make sure to include the flag below during installation:--set kubedb-metrics.enabled=truekubedb-metricscreatesMetricsConfigurationobjects for each database type, which Panopticon (see Configuration) uses to expose metrics to Prometheus.MSSQLServer requires TLS to be enabled. You need a cert-manager
Issuerin thedemonamespace before deploying. If cert-manager is not installed, install it first:$ helm repo add jetstack https://charts.jetstack.io $ helm repo update $ helm upgrade --install cert-manager jetstack/cert-manager \ --namespace cert-manager --create-namespace \ --set crds.enabled=trueThen create a self-signed
Issuerin thedemonamespace:apiVersion: cert-manager.io/v1 kind: Issuer metadata: name: mssqlserver-ca-issuer namespace: demo spec: selfSigned: {}$ kubectl apply -f issuer.yaml issuer.cert-manager.io/mssqlserver-ca-issuer createdTo keep monitoring resources isolated, we use a separate
monitoringnamespace and deploy the database in thedemonamespace.$ kubectl create ns monitoring namespace/monitoring created $ kubectl create ns demo namespace/demo created
- Before proceeding, complete the Configuration steps to deploy kube-prometheus-stack and Panopticon.
Note: YAML files used in this tutorial are stored in docs/examples/mssqlserver/monitoring folder in GitHub repository kubedb/docs.
Setup
Step 1: Deploy MSSQLServer
Below is the MSSQLServer object with TLS and monitoring configured to use Prometheus Operator.
apiVersion: kubedb.com/v1alpha2
kind: MSSQLServer
metadata:
name: mssql-grafana-demo
namespace: demo
spec:
version: "2022-cu12"
replicas: 1
tls:
issuerRef:
name: mssqlserver-ca-issuer
kind: Issuer
apiGroup: "cert-manager.io"
clientTLS: false
deletionPolicy: WipeOut
storage:
storageClassName: "standard"
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
monitor:
agent: prometheus.io/operator
prometheus:
serviceMonitor:
labels:
release: prometheus
interval: 10s
Here,
tls.issuerRefis required for MSSQLServer; it references the cert-manager Issuer created above.monitor.agent: prometheus.io/operatortells KubeDB to create aServiceMonitorfor this instance.monitor.prometheus.serviceMonitor.labelsmust match theserviceMonitorSelectorlabel of your Prometheus (release: prometheus).monitor.prometheus.serviceMonitor.intervalsets the scrape interval to 10 seconds.
Create the MSSQLServer instance:
$ kubectl create -f https://github.com/kubedb/docs/raw/v2026.7.10/docs/examples/mssqlserver/monitoring/mssql-grafana-demo.yaml
mssqlserver.kubedb.com/mssql-grafana-demo created
Wait for it to be Ready:
$ kubectl get mssqlserver -n demo mssql-grafana-demo
NAME VERSION STATUS AGE
mssql-grafana-demo 2022-cu12 Ready 3m
KubeDB creates a stats service named {mssqlserver-name}-stats for the exporter:
$ kubectl get svc -n demo --selector="app.kubernetes.io/instance=mssql-grafana-demo"
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
mssql-grafana-demo ClusterIP 10.96.10.1 <none> 1433/TCP 3m
mssql-grafana-demo-stats ClusterIP 10.96.10.2 <none> 9399/TCP 3m
KubeDB also creates a ServiceMonitor in the demo namespace:
$ kubectl get servicemonitor -n demo
NAME AGE
mssql-grafana-demo-stats 3m
Verify it carries the correct label:
$ kubectl get servicemonitor -n demo mssql-grafana-demo-stats -o jsonpath='{.metadata.labels}'
{"release":"prometheus", ...}
Step 2: Verify Prometheus is Scraping
Port-forward the Prometheus pod:
$ kubectl port-forward -n monitoring \
prometheus-prometheus-kube-prometheus-prometheus-0 9090
Forwarding from 127.0.0.1:9090 -> 9090
Forwarding from [::1]:9090 -> 9090
Open http://localhost:9090/targets in your browser. Look for an entry whose service label matches mssql-grafana-demo-stats. Its state should be UP.

If the target is missing, check that the ServiceMonitor label (release: prometheus) matches the Prometheus serviceMonitorSelector.
Step 3: Access Grafana
Port-forward the Grafana service:
$ kubectl port-forward -n monitoring svc/prometheus-grafana 3000:80
Forwarding from 127.0.0.1:3000 -> 80
Open http://localhost:3000. The username is admin. Retrieve the auto-generated password from the secret:
$ kubectl get secret -n monitoring prometheus-grafana \
-o jsonpath='{.data.admin-password}' | base64 -d
| Field | Value |
|---|---|
| Username | admin |
| Password | output of the command above |

After a successful login you will see the Grafana home page:

Step 4: Configure Prometheus as a Data Source
If you installed Grafana via kube-prometheus-stack, Prometheus is already configured as the default data source — skip to Step 5.
If you’re using a different Grafana instance than the one installed in the Configuration prerequisite (linked in “Before You Begin” above), add Prometheus as a data source manually:
Go to Connections → Data sources → Add new data source.
Select Prometheus.
Set the URL to your Prometheus service:
http://prometheus-operated.monitoring.svc:9090Click Save & test. You should see
Data source is working.
Step 5: Import Dashboard — Option A: Automatic (chart)
Rather than downloading and uploading each JSON file by hand (Option B below), KubeDB ships a chart that creates all matching dashboards for you as GrafanaDashboard custom resources. A separate controller, grafana-operator, watches these resources and pushes the actual dashboard JSON into your Grafana instance — both pieces are required.
1. Install grafana-operator (skip if it’s already running in your cluster):
$ helm repo add appscode https://charts.appscode.com/stable/
$ helm repo update
$ helm upgrade --install grafana-operator appscode/grafana-operator \
--version v2026.6.12 \
--namespace kubeops --create-namespace
2. Register your Grafana instance as an AppBinding (skip if you’ve already done this in another guide on this cluster). grafana-operator needs to know where to push dashboards and how to authenticate — it reads this from an AppBinding object, not from the chart install command itself. Since Grafana here came bundled with kube-prometheus-stack, reuse its existing admin credentials:
$ kubectl port-forward -n monitoring svc/prometheus-grafana 3000:80 &
$ curl -s -X POST -H "Content-Type: application/json" \
-u admin:<grafana_password> \
http://localhost:3000/api/auth/keys \
-d '{"name":"kubedb-dashboards","role":"Admin"}'
# Note the returned "key"
$ kill %1
$ kubectl create secret generic grafana-admin-token -n monitoring \
--from-literal=token='<key-from-above>'
$ cat <<EOF | kubectl apply -f -
apiVersion: appcatalog.appscode.com/v1alpha1
kind: AppBinding
metadata:
name: grafana
namespace: monitoring
spec:
type: monitoring.appscode.com/grafana
clientConfig:
url: http://prometheus-grafana.monitoring.svc:80
secret:
name: grafana-admin-token
EOF
3. Install the dashboards:
The chart packages dashboard JSON for every database it supports, so install it from a copy trimmed down to just MSSQLServer’s dashboards (this also keeps grafana-operator from creating dashboards for databases you don’t run):
$ helm pull appscode/kubedb-grafana-dashboards --version v2026.7.10 --untar
$ cd kubedb-grafana-dashboards/dashboards
$ ls | grep -v '^mssqlserver$' | xargs rm -rf # keep only dashboards/mssqlserver
$ cd ../..
$ helm package kubedb-grafana-dashboards
Successfully packaged chart and saved it to: kubedb-grafana-dashboards-v2026.7.10.tgz
$ helm upgrade -i kubedb-grafana-dashboards-mssqlserver ./kubedb-grafana-dashboards-v2026.7.10.tgz \
-n kubeops --create-namespace \
--set grafana.name=grafana \
--set grafana.namespace=monitoring
Use a release name unique to this database (
kubedb-grafana-dashboards-mssqlserver), not the plainkubedb-grafana-dashboardsname — if you also follow another DB’s Grafana Dashboard guide on this same cluster, eachhelm upgrade -iunder a shared release name would prune the previous DB’s dashboards (Helm removes anything not in the new release’s manifest). A per-DB release name lets them coexist.
grafana.name/grafana.namespace point the chart’s GrafanaDashboard resources at the AppBinding created in step 2 (omitting them falls back to whichever AppBinding in your cluster is labeled as the cluster-default Grafana, if any — explicit is safer on a shared cluster). No need to touch featureGates — with every other database’s dashboards/ folder removed, their gates simply match zero files and render nothing, regardless of being true by default.
This creates every dashboard the chart ships for MSSQLServer — KubeDB / MSSQLServer / Summary, KubeDB / MSSQLServer / Pod, KubeDB / MSSQLServer / Database — which grafana-operator then pushes into your Grafana instance automatically. No manual JSON download or upload needed.
Verify they landed:
$ kubectl get grafanadashboards.openviz.dev -n kubeops | grep -i mssqlserver
NAME TITLE SYNCED AGE
grafana-kubedb-mssqlserver-summary KubeDB / MSSQLServer / Summary Current 30s
grafana-kubedb-mssqlserver-pod KubeDB / MSSQLServer / Pod Current 30s
grafana-kubedb-mssqlserver-database KubeDB / MSSQLServer / Database Current 30s
SYNCED: Current confirms grafana-operator successfully pushed each dashboard into Grafana. Open Grafana — the dashboard are already there under Dashboards, fully wired to your Prometheus data source, ready to explore in Step 6 below.
If the SYNCED column is missing entirely from your output (not just showing a non-Current value), grafana-operator most likely never processed the resource at all. Check that the operator pod is actually running (kubectl get pods -n kubeops -l app.kubernetes.io/name=grafana-operator), inspect its logs for AppBinding/auth errors (kubectl logs -n kubeops deploy/grafana-operator), and check kubectl get grafanadashboards.openviz.dev -n kubeops <name> -o yaml for status.conditions — the CR existing only means kubectl accepted it, not that it reached Grafana.
After importing them, they will appear under Dashboards in the left sidebar as well:
| Dashboard Name | Description |
|---|---|
| KubeDB / MSSQLServer / Summary | Instance status, version, node count, resource requests/limits, CPU usage |
| KubeDB / MSSQLServer / Pod | Per-pod status, role (Primary/Secondary), uptime, server resource overview, connections |
| KubeDB / MSSQLServer / Database | Service status/uptime, AG cluster replica roles, cluster status, SQL compilations, batch requests |
Step 5: Import Dashboard — Option B: Manual (JSON upload)
If you’d rather not run grafana-operator, or want fine-grained control over exactly which dashboards get imported, upload the same dashboard JSON files by hand instead.
The KubeDB MSSQLServer dashboards are distributed as JSON files. Each JSON file is a complete dashboard definition — panels, queries, variables, and layout — that Grafana loads in one shot. Without importing, you would have to build every panel and write every PromQL query by hand. Importing lets you skip that entirely.
Three dashboards are available. Download all three JSON files from the appscode/grafana-dashboards repository (mssqlserver/ folder):
| File | Dashboard |
|---|---|
mssqlserver_summary_dashboard.json | KubeDB / MSSQLServer / Summary |
mssqlserver_pods_dashboard.json | KubeDB / MSSQLServer / Pod |
mssqlserver_databases_dashboard.json | KubeDB / MSSQLServer / Database |
Import steps (repeat for each of the three files):
- In Grafana, click the
+icon in the left sidebar. - Select
Importfrom the menu. - Click
Upload JSON fileand select one of the downloaded.jsonfiles. - In the
Prometheusdropdown that appears, select your Prometheus data source. - Click
Import.
The import page looks like this — click Upload dashboard JSON file to select the file:

After importing all three files, they will appear under Dashboards in the left sidebar.
Step 6: Explore the Dashboard
After opening a dashboard, use the dropdown filters at the top to focus on a specific instance.
| Variable | Applies to | What to select |
|---|---|---|
| Namespace | All dashboards | Namespace where your MSSQLServer is deployed (e.g., demo) |
| mssqlserver | All dashboards | Name of your instance (e.g., mssql-grafana-demo) |
| Pod Name | Pod dashboard | A specific pod (e.g., mssql-grafana-demo-0) |
| Job / database | Pod dashboard | The stats job and target database to inspect |
KubeDB / MSSQLServer / Summary — start here for an instance overview:
- General Info — database status, version, whether secure transport is required, deletion policy, total nodes
- Resource Requests / Limits — configured CPU, memory, and storage requests and limits
- CPU Info / CPU Quota — per-pod CPU usage over time and quota utilization

KubeDB / MSSQLServer / Pod — drill into a specific pod:
- Pod Name / Status / Role / Uptime — pod identity, running status, Availability Group role (Primary/Secondary), and uptime
- Server Resource Overview — server local time, total and used RAM, pagefile size and usage
- Server Resource Overview (2) — total page faults, batch requests/sec, page life expectancy, deadlocks, user errors/sec, kill connection errors/sec
- Summary — current database connections, log growth since last restart, total I/O stall wait time

KubeDB / MSSQLServer / Database — Availability Group cluster health:
- Service Status / Uptime — per-pod health and how long each pod has been serving
- AG Cluster Active Replica — which pod is acting as the active replica
- Cluster Status — count of Primary vs. Secondary replicas
- SQL Compilations/sec — per-pod query compilation rate
- Batch Requests per Second — per-pod T-SQL batch throughput

Cleaning up
# Remove the MSSQLServer instance
kubectl delete mssqlserver -n demo mssql-grafana-demo
# Remove the TLS Issuer
kubectl delete issuer mssqlserver-ca-issuer -n demo
# Remove namespaces
kubectl delete ns demo
# Uninstall the Grafana dashboards chart, if you used Option A
helm uninstall kubedb-grafana-dashboards-mssqlserver -n kubeops
# Uninstall grafana-operator (optional — skip if other DB guides on this cluster still use it)
helm uninstall grafana-operator -n kubeops
# Uninstall monitoring stack (optional)
helm uninstall prometheus -n monitoring
helm uninstall panopticon -n kubeops
kubectl delete ns monitoring kubeops
Next Steps
- Monitor your MSSQLServer instance with KubeDB using Prometheus Operator.
- Want to hack on KubeDB? Check our contribution guidelines.
































