The Simplest Way to Make CockroachDB and Portworx Work Like They Should
Running cockroachdb and portworx together provides persistent block storage for distributed SQL pods in Kubernetes. Portworx manages the underlying volumes while CockroachDB handles SQL queries and data distribution across nodes. This pairing lets platform teams run stateful database clusters on container platforms. Portworx attaches virtual volumes to each database pod and handles volume snapshots. CockroachDB runs on top of those volumes to serve transactional data to your apps. Getting the t
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
Running cockroachdb and portworx together provides persistent block storage for distributed SQL pods in Kubernetes. Portworx manages the underlying volumes while CockroachDB handles SQL queries and data distribution across nodes.
This pairing lets platform teams run stateful database clusters on container platforms. Portworx attaches virtual volumes to each database pod and handles volume snapshots. CockroachDB runs on top of those volumes to serve transactional data to your apps. Getting the two layers to work well requires careful choices around storage rules and permissions.
How data and permissions flow between cockroachdb and portworx
In this setup, Kubernetes acts as the bridge between the database and the storage layer. A StatefulSet requests storage through a PersistentVolumeClaim that points to a Portworx StorageClass. Portworx then provisions a block volume from the local disks on the host nodes. The CockroachDB pod mounts that volume and writes its Raft logs and table data there.
Identity and permissions work across two distinct planes in this architecture. Portworx uses Kubernetes service accounts and storage secrets to check volume requests and encrypt disks. CockroachDB uses client certificates or user passwords to verify people and apps running SQL queries. You must lock down both layers so a storage admin cannot read raw database rows.
Data flows from the app into a CockroachDB node over a TLS connection. The database breaks the data into ranges and sends copies to other database pods. Each pod writes its copy to its attached Portworx volume on the host disk.
Common failure modes and how to scope roles
The biggest mistake teams make with these two tools is turning on double replication. CockroachDB already makes three or more copies of every data range across your cluster. If Portworx also makes three copies of each volume, one write turns into nine writes. This burns disk space and slows down every SQL query in your app. You should set the Portworx replication factor to one or two when CockroachDB handles replication. You should also tell Portworx not to place volumes for different pods on the same host.
Shared admin credentials create another major risk in day-to-day database work. Teams often hand out a single root database user for debugging slow queries. At the same time, platform engineers may share broad Kubernetes roles that control Portworx volumes. When an incident happens, nobody can tell who ran a bad query or changed a volume.
End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
To fix this, separate storage roles from database roles in your cluster. Give Kubernetes service accounts only the permissions needed to bind volumes for the database pods. Inside CockroachDB, create narrow SQL roles tied to specific tables rather than full cluster admin rights. Restrict network paths so only authorized pods can reach the database SQL port and the storage ports.
Day two operations for database and storage teams
Running stateful workloads on Kubernetes requires clear rules for node upgrades and volume backups. When you drain a node for maintenance, both the database and storage layer react. CockroachDB shifts active range leases away from the draining pod to keep queries fast. Portworx detaches the volume from the old node or keeps it ready on the local disk. Your team should coordinate drain timeouts so Portworx does not move volumes while CockroachDB rebalances data.
Backups also need a clear split of duties between the two systems. Database teams should use native CockroachDB backups to capture consistent SQL state across all nodes. Storage teams can use Portworx snapshots for fast local recovery of a single broken disk. Keeping audit logs for both backup paths helps teams pass security reviews and track data access.
Check database and API queries on the wire
Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.
Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.
Frequently asked questions
Should both CockroachDB and Portworx replicate data at the same time?
No, full replication at both layers wastes disk I/O and hurts write speed. Keep normal three-way replication in CockroachDB and lower the Portworx replication factor to avoid write amplification.
How do you prevent data loss when a Kubernetes node fails?
Use anti-affinity rules in both Kubernetes and the Portworx StorageClass. This ensures that each CockroachDB pod and its backing volume sit on a separate physical host.
How should engineers run live SQL queries during an incident?
Engineers should log in with their own identity instead of a shared root account. Masking rules can also rewrite sensitive fields like emails or card numbers in query results.
Short role checks help teams work fast. Simple rules make each review clear. Good logs keep every team safe. Scoped keys stop bad changes early.
Teams test new role rules in staging first. Clear owner lists speed up each audit. Small role scopes cut down on risk. Regular log checks catch drift right away.
Related guides
In this post