Arkanis.Aspire.Hosting.Extensions.Kubernetes.CloudNativePostgres 1.0.0-dev.4

This is a prerelease version of Arkanis.Aspire.Hosting.Extensions.Kubernetes.CloudNativePostgres.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Arkanis.Aspire.Hosting.Extensions.Kubernetes.CloudNativePostgres --version 1.0.0-dev.4
                    
NuGet\Install-Package Arkanis.Aspire.Hosting.Extensions.Kubernetes.CloudNativePostgres -Version 1.0.0-dev.4
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Arkanis.Aspire.Hosting.Extensions.Kubernetes.CloudNativePostgres" Version="1.0.0-dev.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Arkanis.Aspire.Hosting.Extensions.Kubernetes.CloudNativePostgres" Version="1.0.0-dev.4" />
                    
Directory.Packages.props
<PackageReference Include="Arkanis.Aspire.Hosting.Extensions.Kubernetes.CloudNativePostgres" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Arkanis.Aspire.Hosting.Extensions.Kubernetes.CloudNativePostgres --version 1.0.0-dev.4
                    
#r "nuget: Arkanis.Aspire.Hosting.Extensions.Kubernetes.CloudNativePostgres, 1.0.0-dev.4"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Arkanis.Aspire.Hosting.Extensions.Kubernetes.CloudNativePostgres@1.0.0-dev.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Arkanis.Aspire.Hosting.Extensions.Kubernetes.CloudNativePostgres&version=1.0.0-dev.4&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Arkanis.Aspire.Hosting.Extensions.Kubernetes.CloudNativePostgres&version=1.0.0-dev.4&prerelease
                    
Install as a Cake Tool

Arkanis.Aspire.Hosting.Extensions.Kubernetes.CloudNativePostgres

NuGet License

.NET Aspire hosting extensions for publishing CloudNativePG database resources. This package maps Aspire PostgreSQL resources to CloudNativePG database manifests and credentials backed by External Secrets.

Installation

dotnet add package Arkanis.Aspire.Hosting.Extensions.Kubernetes.CloudNativePostgres

Quick Start

using Aspire.Hosting;
using Aspire.Hosting.Extensions.Kubernetes;
using Aspire.Hosting.Extensions.Kubernetes.CloudNativePostgres;
using Aspire.Hosting.Extensions.Kubernetes.ExternalSecrets;
using Aspire.Hosting.Extensions.Kubernetes.KubernetesConnections;

var builder = DistributedApplication.CreateBuilder(args);

var postgres = builder.AddPostgres("postgres");
var api = builder.AddProject<Projects.Api>("api");
var kubernetes = builder.AddKubernetesEnvironment("kubernetes");

postgres.WithCloudNativePostgresDatabase(database => database
    .WithClusterName("production")
    .WithDatabaseName("application")
    .InKubernetesEnvironment(kubernetes)
    .WithCredentialsSecret(credentials => credentials
        .FromSourceSecret("application-credentials")
        .ToTargetSecret("postgres-connection", "ConnectionStrings__ApplicationDatabase")
        .UsingSecretStore(ExternalSecretStoreOptions.ClusterSecretStore("postgres-production-credentials"))
        .RefreshEvery("30m")));

api.WithKubernetesConnectionString(postgres, "ApplicationDatabase");

builder.Build().Run();

WithCloudNativePostgresDatabase(...) emits the CloudNativePG Database manifest during Kubernetes publish. Credentials are emitted as an External Secrets Operator ExternalSecret that reads the CloudNativePG credential Secret and writes an application-local connection string Secret. WithKubernetesConnectionString(...) points the consuming workload at that generated Secret through ConnectionStrings__ApplicationDatabase.

Use configuration binding when you prefer appsettings-driven deployment details.

postgres.WithCloudNativePostgresDatabase(database =>
    database.WithConfigurationFrom(builder.Configuration));

Scope

This package emits CloudNativePG and External Secrets publishing intent during Aspire publish. It does not install CloudNativePG, install External Secrets Operator, create operator credentials, or apply generated manifests to a live cluster.

Generated Names

WithCloudNativePostgresDatabase emits a CloudNativePG Database custom resource whose spec.name is the configured DatabaseName value, or the Aspire resource name when DatabaseName is omitted. The custom resource metadata.name defaults to {ClusterName}-{DatabaseName} after Kubernetes object-name normalization, or {ClusterName}-{ResourceName} when DatabaseName is omitted. Use MetadataName in configuration or WithMetadataName(...) in code to preserve an existing object name or choose a different Kubernetes object name. Credentials secret defaults remain resource-local: the source platform secret defaults to the effective database name with -credentials after normalization, while the target app secret defaults to {ResourceName}-connection after normalization.

Dependencies

This package references Arkanis.Aspire.Hosting.Extensions.Kubernetes. This package also references Arkanis.Aspire.Hosting.Extensions.Kubernetes.ExternalSecrets.

Repository

Source, issues, and release workflow details are available at https://github.com/ArkanisCorporation/Aspire.Hosting.Extensions.Kubernetes.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-dev.7 112 7/5/2026
1.0.0-dev.6 56 7/5/2026
1.0.0-dev.5 85 7/4/2026
1.0.0-dev.4 71 7/3/2026
1.0.0-dev.3 62 7/2/2026
1.0.0-dev.2 304 6/16/2026
1.0.0-dev.1 88 6/11/2026