Skip to content
Docs Try Aspire
Docs Try

KubernetesHelmChartResource

Class sealed net8.0
📦 Aspire.Hosting.Kubernetes v13.4.0-preview.1.26281.18
Represents an external Helm chart to be installed into a Kubernetes environment. This resource models a Helm chart from a repository (OCI or HTTP) that will be installed as a pipeline step after the main application Helm chart is deployed.
namespace Aspire.Hosting.Kubernetes;
public sealed class KubernetesHelmChartResource
: Aspire.Hosting.ApplicationModel.Resource,
Aspire.Hosting.ApplicationModel.IResource,
Aspire.Hosting.ApplicationModel.IResourceWithParent,
Aspire.Hosting.ApplicationModel.IResourceWithParent<Aspire.Hosting.Kubernetes.KubernetesEnvironmentResource>
{
// ...
}
ResourceIResourceIResourceWithParentIResourceWithParent<KubernetesEnvironmentResource>

Create a Helm chart resource using KubernetesHelmChartExtensions.AddHelmChart and configure it with values using KubernetesHelmChartExtensions.WithHelmValue.

At deploy time, the chart is installed via helm upgrade --install as a pipeline step that runs after the main application Helm chart is deployed. The chart is installed into the specified namespace (defaulting to the chart name).

By default, an external Helm chart is not uninstalled by aspire destroy. Opt in to destroy-time uninstall by calling KubernetesHelmChartExtensions.WithDestroy.

var k8s = builder.AddKubernetesEnvironment("k8s");
// Install NGINX Ingress Controller from OCI registry
k8s.AddHelmChart("nginx", "oci://ghcr.io/nginx/charts/nginx-ingress", "1.5.0");
// Install cert-manager with custom values
k8s.AddHelmChart("cert-manager", "oci://quay.io/jetstack/charts/cert-manager", "1.17.0")
.WithHelmValue("crds.enabled", "true")
.WithHelmValue("config.enableGatewayAPI", "true");