Building a Cloud-Native Secrets Infrastructure with OpenBao and CloudNativePG

Managing infrastructure secrets on Kubernetes requires a backend that is self-healing, high-performing, and free from the restrictive nature of vendor lock-in. As organizations shift away from proprietary, managed secret stores, a new open-source architecture is emerging as the gold standard for platform engineers. By combining OpenBao—the Linux Foundation’s open-source fork of HashiCorp Vault—with CloudNativePG (CNPG), organizations can now deploy an entirely open-source stack built on foundational Cloud Native Computing Foundation (CNCF) projects. This architecture leverages Kubernetes for orchestration and CloudNativePG to provide a self-healing, synchronously replicated, and certificate-authenticated PostgreSQL instance that functions as the encrypted key-value store for OpenBao.
The Evolution of Secret Management in Kubernetes
For years, the industry relied on managed cloud services to handle the complexities of key-value storage and secret rotation. However, as the ecosystem matured, the demand for portable, vendor-neutral infrastructure grew. Kubernetes, having long since graduated as a CNCF project, provides the necessary primitives for this shift. CloudNativePG, currently under evaluation for incubation by the CNCF Technical Oversight Committee, has become the preferred choice for managing PostgreSQL on Kubernetes due to its ability to treat the database as a first-class citizen of the cluster rather than an external dependency.
The integration of OpenBao with CloudNativePG represents a significant shift in how secrets are handled. By utilizing a PostgreSQL storage backend, OpenBao turns any PostgreSQL cluster into its primary key-value store. When managed by the CNPG operator, this database instance gains robust high-availability features, including synchronous replication and automated certificate-based authentication, effectively eliminating the need for hardcoded credentials.
Architectural Blueprint and Security Posture
The architecture described in this deployment model moves beyond traditional password-based authentication. In this recipe, a three-instance CNPG cluster serves as the storage engine for OpenBao. A critical component of this security strategy is the enforcement of TLS client certificates for all database connections. The schema-owning role and the application-specific role used by OpenBao are authenticated exclusively via TLS client certificates enforced by explicit pg_hba (PostgreSQL Host-Based Authentication) rules.
By defining specific rules in pg_hba.conf, administrators can mandate that connections originate only from authenticated sources presenting valid certificates. This approach shifts the security posture from a "password-reliant" model—which is prone to credential leaks—to a "certificate-enforced" model, where the absence of a password is a structural security feature rather than a configuration oversight.
Deployment Chronology: A Step-by-Step Implementation
The deployment process follows a structured methodology designed to minimize human error and ensure cluster stability. To facilitate testing, the cnpg-playground repository provides a standardized environment. This environment uses a six-node Kind (Kubernetes in Docker) cluster, which effectively simulates real-world topology, including control plane nodes and infrastructure-specific workloads.

- Provisioning the Foundation: The process begins by cloning the
cnpg-playgroundrepository and executing thesetup.shscript. This creates a conformant Kubernetes cluster with specific node labels for PostgreSQL workloads. - Deploying the CNPG Cluster: The next phase involves applying a
Clustermanifest that defines a three-instance PostgreSQL cluster. By leveragingClusterImageCatalog, the system automatically resolves the latest minimal PostgreSQL 18 images, ensuring that patch releases are managed without manual intervention. - Schema Initialization: Because
DatabaseRoleobjects currently do not manage granular table-level grants, a one-time KubernetesJobis utilized to initialize the database. This job performs the necessary DDL (Data Definition Language) operations, creating theopenbao_kv_storeandopenbao_ha_lockstables, while simultaneously revoking default permissions from thePUBLICrole to harden the database environment. - OpenBao Integration: The final stage involves installing the OpenBao Helm chart. The configuration must be carefully tuned to mount the client certificate secrets into the pod, point the storage backend to the CNPG service, and disable the default local PVC (Persistent Volume Claim) to ensure that all state is held exclusively within the PostgreSQL cluster.
Data Durability and Operational Integrity
A core advantage of this stack is its commitment to data durability. The CNPG operator utilizes synchronous replication, ensuring an RPO (Recovery Point Objective) of zero. By configuring the synchronous method to any with a count of one, the system guarantees that writes are acknowledged by at least one standby before being considered successful. This dynamic quorum behavior prevents the cluster from pinning to a single, potentially failing standby, thus maintaining high availability even under localized node stress.
Furthermore, the integration addresses the specific challenges of secret encryption. When OpenBao writes data to the PostgreSQL backend, it stores encrypted payloads as BYTEA blobs. This ensures that even in the event of unauthorized access to the database layer, the data remains cryptographically protected. The use of PostgreSQL as a storage backend also enables native backup and disaster recovery workflows, such as those provided by the Barman Cloud plugin, which integrates seamlessly with the CNPG ecosystem.
Analysis of Implications for Enterprise Security
The transition to an open-source, certificate-authenticated secrets stack has profound implications for enterprise IT operations. First, it eliminates the "secret zero" problem—the challenge of managing the initial credentials required to bootstrap the secret management system itself. By using certificate-based authentication, the infrastructure is inherently more resilient to brute-force attacks and credential theft.
Second, the use of Kubernetes CRDs (Custom Resource Definitions) for both the database and the secrets engine enables "GitOps-friendly" infrastructure management. Teams can version-control their database schema, security policies, and application configurations in a unified repository, significantly reducing the gap between development and operations.
However, operational teams must be mindful of the certificate lifecycle. While CNPG automates the renewal of client certificates, OpenBao’s current storage backend does not natively reload TLS material without a process restart. Consequently, platform engineers must implement a scheduled rolling restart of OpenBao pods within the certificate validity window (typically 90 days) to ensure continuous connectivity. This operational requirement is a small trade-off for the heightened security and portability gained by the architecture.
Conclusion and Future Outlook
The synergy between OpenBao and CloudNativePG represents a maturing of the cloud-native ecosystem. By leveraging native Kubernetes primitives and established open-source projects, organizations can build a robust, high-performance secret management system that is both cost-effective and highly secure. As CloudNativePG nears incubation and OpenBao continues to gain traction as a community-driven alternative to legacy vaulting systems, the industry is likely to see an increase in adoption of this self-healing, passwordless architecture.
For organizations currently tethered to proprietary platforms or struggling with the complexities of managing secret stores in hybrid-cloud environments, this stack offers a clear path toward sovereignty, scalability, and enhanced security. Future developments, such as native support for declarative table-level grants and automated certificate reloading, will likely further lower the barrier to entry, solidifying this combination as a cornerstone of modern cloud-native infrastructure.







