Operating self-managed deployments

View as Markdown

This guide covers the infrastructure you run Materialize on: Kubernetes, the metadata database, object storage, configuration, upgrades, and monitoring. It applies only if you run Materialize yourself. For how to run the database itself (sizing, access, changes, upstream systems, and escalation), see Operating Materialize in production, which applies to every deployment. Before go-live, work through the production readiness checklist.

On self-managed, your team owns the platform under Materialize (see the self-managed customer responsibility model), so how quickly an issue gets resolved depends on who on your side has access and what you can see.

1. Ownership and access

Before go-live, decide who owns each area below and make sure at least two people can act on it, including after hours.

Area What they need to be able to do
Kubernetes (kubectl, k9s) View and restart Materialize pods, read pod logs and events, check node health
Materialize custom resource, operator, and Helm or Terraform config Change Materialize configuration and system parameters, ideally through your normal deploy process
Node pools and cloud account Add nodes, change machine types, check quotas, and open urgent cases with your cloud provider
Metadata database Check health, failover status, and settings, and change server parameters in an emergency
Object storage Check bucket access, permissions, and latency
Network and certificates Check load balancers, private networking, DNS, and TLS certificates
Metrics and logs Query metrics, dashboards, and pod logs, and share them with us
Materialize SQL (admin role) Run DDL, resize clusters, and drop or recreate sources

Also confirm what your team is allowed to share with us during an incident, such as logs, debug bundles, and screen sharing, so there’s no delay when we ask.

2. Kubernetes and node capacity

Every Materialize cluster replica needs a node it can run on. When there isn’t one, the clusters they serve stop making progress.

  • Follow the deployment guidelines. Use the instance types, local disk setup, and node configuration recommended in the deployment guidelines.
  • Plan capacity for your largest clusters. Make sure your node pools and autoscaler limits can fit your largest cluster sizes, with room to resize them.
  • Know your cloud provider’s limits. Check your quotas and the available capacity for your instance types in your region, so you can add nodes when you need them.
  • Treat Kubernetes changes like production changes. Plan Kubernetes and node upgrades, and know when your provider’s maintenance windows are, so they don’t surprise the team running Materialize.
  • Alert on capacity problems early. Alert on pods stuck in Pending, nodes that are cordoned, draining, or not ready, and failed node scale-ups, so you can act before replicas are evicted.
  • Leave Materialize’s resource settings alone unless we recommend a change. Lowering memory limits or liveness probe settings can cause restarts that are hard to diagnose.

3. Metadata database

Materialize stores its metadata in a Postgres-compatible database that you run. If that database is unavailable or can’t accept writes, Materialize can’t make progress, even if everything else is healthy.

  • Use a dedicated database. Don’t share the metadata database with other applications, so their load and incidents don’t affect Materialize.
  • Understand your high-availability setup. Know how failover works, how long it takes, and whether writes can block. For example, with synchronous replication, losing the standby can block every write until replication is fixed or the setting is changed.
  • Alert on its health. Watch availability, connection counts, replication status (including the number of connected standbys), disk space, and query latency.
  • Make sure someone can change it quickly. Know who can change server parameters or trigger a failover in an emergency, especially if a managed provider or another team runs it.
  • Know your provider’s escalation path, including how to open an urgent case outside business hours.
  • Test failover in staging, and check how Materialize behaves during and after it.

4. Object storage and network

Materialize writes its data to object storage and depends on the network to reach upstream systems, clients, and cloud services. Slow or failing storage and network paths show up in Materialize as stalls and freshness lag.

Object storage

  • Keep storage close. Use a bucket in the same region as your Kubernetes cluster.
  • Monitor latency and errors. Slow writes or timeouts to object storage translate directly into freshness lag. Alert on error rates and latency, not just availability.
  • Lock down, but don’t break, access. Know which identity Materialize uses to reach the bucket, and make sure policy or key rotations are coordinated with your Materialize owners.
  • Subscribe to your cloud provider’s status page for storage and identity services in your region.

Network and identity

  • Know every network path Materialize uses: from clients to Materialize, from Materialize to each upstream system and sink, and from Materialize to cloud services. Include NAT gateways, private links, firewalls, and DNS.
  • Build in redundancy for network paths that every source depends on, such as NAT gateways, so one failure doesn’t stop all ingestion.
  • Track certificates and credentials. Know when TLS certificates and cloud credentials expire and who renews them.
  • Coordinate network changes. Firewall, routing, and DNS changes should include your Materialize owners in review.

5. Configuration, versions, and upgrades

On self-managed, you decide when to upgrade and how Materialize is configured. Small configuration mistakes and untested upgrades can cause problems.

  • Manage configuration as code. Keep Terraform, Helm values, and the Materialize custom resource in version control, and review changes like application code. Copy-and-paste mistakes in connection strings and URLs are easy to make and hard to spot.
  • Stay on a supported version. Check the self-managed release versions and plan to upgrade regularly, so fixes reach you and you don’t have to jump many versions at once.
  • Read the release notes before every upgrade, and follow the supported paths in the upgrade guide.
  • Upgrade staging first. Run each new version in a staging deployment that matches production (same node types, storage, and a similar workload) before upgrading production.
  • Right-size your replicas for rehydration. Upgrades restart your clusters, and each one has to rehydrate. Make sure production clusters are sized for hydration (see Operating Materialize in production, section 4).
  • Upgrade in a planned window, with someone who can watch the rollout, roll back, and reach us if something goes wrong.

6. Monitor the deployment

Operating Materialize in production covers what to watch inside the database. On self-managed, you also need to collect the data and watch the platform underneath. See Self-managed observability.

Collect metrics and logs

  • Use the bundled monitoring stack. The Materialize Terraform modules (v11.0.0 and later) install a monitoring stack by default. It collects metrics and logs from Materialize and Kubernetes, stores them in your infrastructure, and ships Grafana dashboards, Alertmanager, and a default set of alert rules.
  • Or forward to your own platform. You can send metrics and logs to Datadog, Honeycomb, Google Cloud Monitoring, any OpenTelemetry endpoint, or a Prometheus remote-write store.
  • Keep at least 30 days of Materialize logs and metrics, so you can look back at when a problem started.

Route alerts

  • Configure a receiver. A default install has no alert receiver, so nobody is notified until you set one up. Route alerts to PagerDuty, Slack, Microsoft Teams, email, or a webhook using the alerting guide.
  • Send production alerts to whoever is on call. An alert that only posts to a channel can go unnoticed overnight or over a weekend.

Watch the platform

Area What to alert on
Kubernetes Pods stuck in Pending, pod restarts, nodes cordoned, draining, or not ready, failed scale-ups
Metadata database Availability, replication and standby status, connections, disk space, latency
Object storage Error rates and latency
Network NAT, load balancer, and DNS health; certificate expiry
Monitoring stack Missing metrics or dropped logs, so you know your alerts are still working

For the Prometheus metrics Materialize recommends, see essential metrics.

7. Practice running mz-debug

mz-debug is usually the first thing we ask for when you open a self-managed ticket. It collects pod logs, Kubernetes resource details, system catalog snapshots, Prometheus metrics, and memory profiles into one zip file. Run it at least once before go-live, so you know it works with your permissions and network setup. During an incident, we’ll tell you how to get the output to us.

  1. Install mz-debug on a machine that has kubectl access to your cluster. See the mz-debug docs for install steps.

  2. Find your Materialize instance name:

    kubectl --namespace <materialize-namespace> get materializes.materialize.cloud
    
  3. Run mz-debug against that namespace and instance:

    mz-debug self-managed \
      --k8s-namespace <materialize-namespace> \
      --mz-instance-name <instance-name>
    
  4. Check that it produced a mz_debug_<timestamp>.zip file, and confirm it includes pod logs and system catalog files.

  5. Write down who on your team can run it, where they run it from, and any extra steps your environment needs, such as a VPN, a bastion host, or a specific kubeconfig. Add this to your runbook.

If it fails, open a normal ticket so we can sort it out before you need it in an emergency.

8. Exercise: submit your environment profile

Every self-managed setup is a little different, and those differences are often what slows down an investigation. In this exercise, your team gathers the details of your production environment and submits them to us as a support ticket. When you’re done, we’ll have your setup on file before you ever need us, and your on-call team will have the same information in one place.

Plan for about 90 minutes. Repeat this for each production environment.

  1. Get the right people together. Book a working session with the Materialize owner, someone from your Kubernetes or platform team, and the owner of each upstream database or stream.

  2. Collect your deployment details. Run these and keep the output for the profile:

    # Materialize instance name and spec
    kubectl --namespace <materialize-namespace> get materializes.materialize.cloud -o yaml
    
    # Node machine types
    kubectl get nodes -L node.kubernetes.io/instance-type
    
  3. Fill out the profile. Copy the template below and answer every question. If something doesn’t apply, say so. If nobody knows the answer, that’s useful to find out now: write “unknown” and assign someone to find out.

  4. Submit it as a support ticket. Open a new ticket in the Support Center:

    • Subject: Environment profile: <your company> <environment name>
    • Priority: Normal (this isn’t an outage)
    • Description: Paste your completed profile
    • Attachments: Any architecture diagrams you have

    We’ll review it and reply with any questions or gaps we notice.

  5. Share it with your team. Save the completed profile and the ticket link in your on-call runbook, so whoever is on call has the same information we do.

  6. Keep it current. Reply to the same ticket whenever something changes: a Materialize upgrade, a new region or environment, a new upstream system, a change to your metadata database or node pools, or a new owner or contact. Review the whole profile at least once a quarter.

Environment profile template

# Environment profile: <company> <environment name>

## Contacts and ownership
- Primary Materialize owner (name, email):
- After-hours or on-call contact, and how to reach them:
- Who can approve production changes (resizes, restarts, config changes):
- Kubernetes and cloud account owner:
- Metadata database owner:
- Upstream database or stream owners:
- Restrictions on sharing logs, debug bundles, or screen sharing:

## Deployment
- Materialize version and operator/Helm chart version:
- Install method (Terraform modules, Helm, other) and module version:
- Cloud provider, region, and Kubernetes distribution and version:
- Kubernetes namespace(s) and Materialize instance name:
- Node pool machine types, and any fallback node pools:
- Node auto-upgrade or maintenance windows:
- Other environments (staging, dev) and how they're separated from production:

## Storage, network, and security
- Metadata database: provider, version, HA setup, synchronous or async replication, shared or dedicated:
- Object storage: provider, bucket region, encryption or KMS setup:
- How clients connect (load balancer, private networking, proxies):
- TLS and certificate management:
- Authentication method:

## Sources and sinks
- Upstream systems, versions, and providers:
- Upstream HA and failover setup:
- Objects, users, and permissions Materialize relies on in each upstream system:
- How long each upstream system retains changes:
- Sink destinations:

## Workloads and benchmarks
- Production clusters and the critical objects on each:
- Freshness targets and outage thresholds (see Operating Materialize in production, section 1):
- Busiest times of day or week:
- Expected growth or upcoming launches:

## Monitoring and change management
- Monitoring stack (bundled, or forwarded to which platform):
- Alert receiver and on-call routing:
- Log and metric retention:
- How you deploy changes (dbt, Terraform, GitOps, manual):
- How you test and roll out Materialize upgrades:
- mz-debug: who can run it, and from where:
Back to top ↑