# Aspire.Hosting.Kubernetes

- Module: `Aspire.Hosting.Kubernetes`
- Version: `13.6.5-preview.1.26559.7`
- Import path: `apphost/modules/aspire`
- Source: [GitHub](https://github.com/microsoft/aspire/tree/b33d222049f1ecc3bc7257ec07b622fe550b2580)
- Functions: `62`
- Types: `15`

## Handles

- [CertManagerIssuerResource](/reference/api/go/aspire.hosting.kubernetes/certmanagerissuerresource.md) -- `handle` - 7 members -- Represents a cert-manager `ClusterIssuer` resource in the Aspire application model.
- [CertManagerResource](/reference/api/go/aspire.hosting.kubernetes/certmanagerresource.md) -- `handle` - 1 members -- Represents a cert-manager installation on a Kubernetes environment.
- [HelmChartOptions](/reference/api/go/aspire.hosting.kubernetes/helmchartoptions.md) -- `handle` - 5 members -- Provides options for configuring Helm chart deployment settings on a `KubernetesEnvironmentResource`.
- [KubernetesAspireDashboardResource](/reference/api/go/aspire.hosting.kubernetes/kubernetesaspiredashboardresource.md) -- `handle` - 5 members -- Represents a resource for the Aspire Dashboard deployed into a Kubernetes environment. This resource is used to visualize telemetry data from resources running in the cluster.
- [KubernetesEnvironmentResource](/reference/api/go/aspire.hosting.kubernetes/kubernetesenvironmentresource.md) -- `handle` - 18 members -- Represents a Kubernetes environment resource that can host application resources.
- [KubernetesGatewayResource](/reference/api/go/aspire.hosting.kubernetes/kubernetesgatewayresource.md) -- `handle` - 12 members -- Represents a Kubernetes Gateway API Gateway as a first-class resource in the Aspire application model. A Gateway defines listeners (ports, protocols, TLS) and HTTPRoutes attach to it for routing.
- [KubernetesHelmChartResource](/reference/api/go/aspire.hosting.kubernetes/kuberneteshelmchartresource.md) -- `handle` - 5 members -- 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.
- [KubernetesIngressResource](/reference/api/go/aspire.hosting.kubernetes/kubernetesingressresource.md) -- `handle` - 12 members -- Represents a Kubernetes Ingress as a first-class resource in the Aspire application model. An Ingress defines HTTP routing rules that direct external traffic to services in the cluster.
- [KubernetesManifestResource](/reference/api/go/aspire.hosting.kubernetes/kubernetesmanifestresource.md) -- `handle` - 4 members -- Represents an arbitrary Kubernetes manifest that is emitted with a Kubernetes service.
- [KubernetesNodePoolResource](/reference/api/go/aspire.hosting.kubernetes/kubernetesnodepoolresource.md) -- `handle` - 0 members -- Represents a Kubernetes node pool as a child resource of a `KubernetesEnvironmentResource`. Node pools can be referenced by compute resources to schedule workloads on specific node pools using `KubernetesEnvironmentExtensions.withNodePool`.
- [KubernetesPersistentVolumeResource](/reference/api/go/aspire.hosting.kubernetes/kubernetespersistentvolumeresource.md) -- `handle` - 7 members -- Represents a Kubernetes PersistentVolumeClaim as a first-class resource in the Aspire application model. A persistent volume resource carries the storage class, capacity, access modes, and metadata annotations needed to render a `v1.PersistentVolumeClaim` at publish time. Workloads bind to it with `WithPersistentVolume`.
- [KubernetesResource](/reference/api/go/aspire.hosting.kubernetes/kubernetesresource.md) -- `handle` - 2 members -- Represents a compute resource for Kubernetes.

## Enums

- [GatewayPathMatchType](/reference/api/go/aspire.hosting.kubernetes/gatewaypathmatchtype.md) -- `enum` - 3 values -- Specifies the type of path matching used in a Kubernetes Gateway API `HTTPRoute` rule. The values map directly to the `matches[].path.type` field defined by the Gateway API (see ) and are distinct from the Ingress-flavoured `IngressPathType` because the two specs use different vocabularies (Ingress: `Prefix`, Gateway: `PathPrefix`).
- [IngressPathType](/reference/api/go/aspire.hosting.kubernetes/ingresspathtype.md) -- `enum` - 3 values -- Specifies the type of path matching used in a Kubernetes Ingress rule.
- [PersistentVolumeAccessMode](/reference/api/go/aspire.hosting.kubernetes/persistentvolumeaccessmode.md) -- `enum` - 4 values -- Specifies how a persistent volume may be mounted by pods. Maps directly to the Kubernetes `PersistentVolumeAccessMode` values.

## Functions

- [WithAcmeServer](/reference/api/go/aspire.hosting.kubernetes/withacmeserver.md) -- `method` - on `CertManagerIssuerResource` -- Configures the issuer to use a custom ACME directory endpoint (e.g., a private ACME server such as ZeroSSL or step-ca).
- [WithAcmeServerParam](/reference/api/go/aspire.hosting.kubernetes/withacmeserverparam.md) -- `method` - on `CertManagerIssuerResource` -- Configures the issuer to use a custom ACME directory endpoint with a parameterized email.
- [WithHttp01Solver](/reference/api/go/aspire.hosting.kubernetes/withhttp01solver.md) -- `method` - on `CertManagerIssuerResource` -- Adds an HTTP-01 ACME challenge solver to the issuer. cert-manager will satisfy the challenge by provisioning a temporary HTTP route at `/.well-known/acme-challenge/{token}` on the same hostname being validated. This requires the hostname to be publicly reachable on port 80.
- [WithLetsEncryptProduction](/reference/api/go/aspire.hosting.kubernetes/withletsencryptproduction.md) -- `method` - on `CertManagerIssuerResource` -- Configures the issuer to use the Let's Encrypt production ACME endpoint.
- [WithLetsEncryptProductionParam](/reference/api/go/aspire.hosting.kubernetes/withletsencryptproductionparam.md) -- `method` - on `CertManagerIssuerResource` -- Configures the issuer to use the Let's Encrypt production ACME endpoint, with the contact email supplied via a parameter resolved at deploy time.
- [WithLetsEncryptStaging](/reference/api/go/aspire.hosting.kubernetes/withletsencryptstaging.md) -- `method` - on `CertManagerIssuerResource` -- Configures the issuer to use the Let's Encrypt staging ACME endpoint. Certificates issued from staging are not trusted by browsers, but the endpoint has much higher rate limits, making it the right choice for development and CI workflows.
- [WithLetsEncryptStagingParam](/reference/api/go/aspire.hosting.kubernetes/withletsencryptstagingparam.md) -- `method` - on `CertManagerIssuerResource` -- Configures the issuer to use the Let's Encrypt staging ACME endpoint, with the contact email supplied via a parameter resolved at deploy time.
- [AddIssuer](/reference/api/go/aspire.hosting.kubernetes/addissuer.md) -- `method` - on `CertManagerResource` -- Adds a cert-manager `ClusterIssuer` to this cert-manager installation.
- [AddKubernetesEnvironment](/reference/api/go/aspire.hosting.kubernetes/addkubernetesenvironment.md) -- `method` - on `DistributedApplicationBuilder` -- Adds a Kubernetes environment to the application model.
- [PublishAsKubernetesService](/reference/api/go/aspire.hosting.kubernetes/publishaskubernetesservice.md) -- `method` - on `IComputeResource` -- Publishes the specified resource as a Kubernetes service.
- [WithKubernetesPersistentVolume](/reference/api/go/aspire.hosting.kubernetes/withkubernetespersistentvolume.md) -- `method` - on `IComputeResource` -- Binds a workload to a Kubernetes persistent volume by matching volume name
- [WithKubernetesPersistentVolumeMount](/reference/api/go/aspire.hosting.kubernetes/withkubernetespersistentvolumemount.md) -- `method` - on `IComputeResource` -- Binds a workload to a Kubernetes persistent volume and mounts it at a path
- [WithForwardedHeaders](/reference/api/go/aspire.hosting.kubernetes/withforwardedheaders.md) -- `method` - on `KubernetesAspireDashboardResource` -- Configures whether forwarded headers processing is enabled for the Aspire dashboard container.
- [WithOtlpServicePort](/reference/api/go/aspire.hosting.kubernetes/withotlpserviceport.md) -- `method` - on `KubernetesAspireDashboardResource` -- Sets the Kubernetes Service ports for the Aspire Dashboard OTLP endpoints.
- [WithServicePort](/reference/api/go/aspire.hosting.kubernetes/withserviceport.md) -- `method` - on `KubernetesAspireDashboardResource` -- Sets the Kubernetes Service port for the Aspire Dashboard HTTP endpoint.
- [AddCertManager](/reference/api/go/aspire.hosting.kubernetes/addcertmanager.md) -- `method` - on `KubernetesEnvironmentResource` -- Installs cert-manager into a Kubernetes environment
- [AddGateway](/reference/api/go/aspire.hosting.kubernetes/addgateway.md) -- `method` - on `KubernetesEnvironmentResource` -- Adds a Kubernetes Gateway API Gateway resource to the application model as a child of the specified Kubernetes environment. The gateway generates a `gateway.networking.k8s.io/v1 Gateway` resource and one or more `HTTPRoute` resources in the Helm chart output at publish time.
- [AddHelmChart](/reference/api/go/aspire.hosting.kubernetes/addhelmchart.md) -- `method` - on `KubernetesEnvironmentResource` -- Adds an external Helm chart to be installed in the Kubernetes environment. The chart is installed via `helm upgrade --install` as a pipeline step after the main application Helm chart is deployed.
- [AddIngress](/reference/api/go/aspire.hosting.kubernetes/addingress.md) -- `method` - on `KubernetesEnvironmentResource` -- Adds a Kubernetes Ingress resource to the application model as a child of the specified Kubernetes environment. The ingress generates a `networking.k8s.io/v1 Ingress` resource in the Helm chart output at publish time.
- [AddNodePool](/reference/api/go/aspire.hosting.kubernetes/addnodepool.md) -- `method` - on `KubernetesEnvironmentResource` -- Adds a named node pool to the Kubernetes environment.
- [AddPersistentVolume](/reference/api/go/aspire.hosting.kubernetes/addpersistentvolume.md) -- `method` - on `KubernetesEnvironmentResource` -- Adds a Kubernetes PersistentVolumeClaim resource
- [ConfigureDashboard](/reference/api/go/aspire.hosting.kubernetes/configuredashboard.md) -- `method` - on `KubernetesEnvironmentResource` -- Configures the dashboard properties for this Kubernetes environment.
- [WithDashboard](/reference/api/go/aspire.hosting.kubernetes/withdashboard.md) -- `method` - on `KubernetesEnvironmentResource` -- Enables the Aspire dashboard for telemetry visualization in this Kubernetes environment.
- [WithHelm](/reference/api/go/aspire.hosting.kubernetes/withhelm.md) -- `method` - on `KubernetesEnvironmentResource` -- Configures the Kubernetes environment to deploy using Helm charts.
- [WithProperties](/reference/api/go/aspire.hosting.kubernetes/withproperties.md) -- `method` - on `KubernetesEnvironmentResource` -- Allows setting the properties of a Kubernetes environment resource.
- [WithGatewayAnnotation](/reference/api/go/aspire.hosting.kubernetes/withgatewayannotation.md) -- `method` - on `KubernetesGatewayResource` -- Adds a Kubernetes metadata annotation to the generated Gateway resource.
- [WithGatewayAnnotationParam](/reference/api/go/aspire.hosting.kubernetes/withgatewayannotationparam.md) -- `method` - on `KubernetesGatewayResource` -- Adds a Kubernetes metadata annotation with a parameter value that will be resolved at deploy time.
- [WithGatewayClass](/reference/api/go/aspire.hosting.kubernetes/withgatewayclass.md) -- `method` - on `KubernetesGatewayResource` -- Sets the GatewayClass name that selects which controller implementation handles this gateway.
- [WithGatewayClassParam](/reference/api/go/aspire.hosting.kubernetes/withgatewayclassparam.md) -- `method` - on `KubernetesGatewayResource` -- Sets the GatewayClass name using a parameter that will be resolved at deploy time.
- [WithGatewayHostnameParam](/reference/api/go/aspire.hosting.kubernetes/withgatewayhostnameparam.md) -- `method` - on `KubernetesGatewayResource` -- Adds a hostname using a parameter that will be resolved at deploy time.
- [WithGatewayHostRoute](/reference/api/go/aspire.hosting.kubernetes/withgatewayhostroute.md) -- `method` - on `KubernetesGatewayResource` -- Adds a host-and-path-based routing rule to the gateway. The rule matches traffic for the specified host and path, routing it to the given endpoint's backing Kubernetes service. This generates an `HTTPRoute` resource with a `hostnames` filter.
- [WithGatewayPathRoute](/reference/api/go/aspire.hosting.kubernetes/withgatewaypathroute.md) -- `method` - on `KubernetesGatewayResource` -- Adds a path-based routing rule to the gateway. The rule matches each hostname configured with `WithHostname`, or all hosts when no hostname is configured, and routes matching traffic to the endpoint's backing Kubernetes service. This generates an `HTTPRoute` resource attached to the Gateway.
- [WithGatewayTlsAuto](/reference/api/go/aspire.hosting.kubernetes/withgatewaytlsauto.md) -- `method` - on `KubernetesGatewayResource` -- Configures TLS termination with an auto-generated secret name derived from the gateway name.
- [WithGatewayTlsIssuer](/reference/api/go/aspire.hosting.kubernetes/withgatewaytlsissuer.md) -- `method` - on `KubernetesGatewayResource` -- Adds an HTTPS listener to the gateway and wires it to the supplied cert-manager `ClusterIssuer`. This adds the `cert-manager.io/cluster-issuer` annotation to the generated Gateway resource, causing cert-manager to provision and renew a certificate for each gateway listener hostname.
- [WithGatewayTlsParam](/reference/api/go/aspire.hosting.kubernetes/withgatewaytlsparam.md) -- `method` - on `KubernetesGatewayResource` -- Configures TLS termination using a parameter for the secret name.
- [WithHostname](/reference/api/go/aspire.hosting.kubernetes/withhostname-kubernetesgatewayresource-string.md) -- `method` - on `KubernetesGatewayResource` -- Adds a hostname that this gateway's routes match. Multiple hostnames can be added by calling this method repeatedly. Routes without an explicit host apply to each configured hostname. Hostnames are used as `hostnames` in generated `HTTPRoute` resources and as HTTPS listener hostnames when TLS is configured.
- [WithTls](/reference/api/go/aspire.hosting.kubernetes/withtls-kubernetesgatewayresource-string.md) -- `method` - on `KubernetesGatewayResource` -- Configures TLS on a Kubernetes Gateway listener
- [WithHelmChartDestroy](/reference/api/go/aspire.hosting.kubernetes/withhelmchartdestroy.md) -- `method` - on `KubernetesHelmChartResource` -- Opts the Helm chart in to destroy-time uninstall. When set, `aspire destroy` will run `helm uninstall` for this release as part of the destroy pipeline.
- [WithHelmChartForceConflicts](/reference/api/go/aspire.hosting.kubernetes/withhelmchartforceconflicts.md) -- `method` - on `KubernetesHelmChartResource` -- Opts the Helm chart in to `helm upgrade --install --force-conflicts`. When set, Helm's server-side apply forcibly takes over any fields owned by another field manager instead of failing with a conflict.
- [WithHelmChartNamespace](/reference/api/go/aspire.hosting.kubernetes/withhelmchartnamespace.md) -- `method` - on `KubernetesHelmChartResource` -- Sets the Kubernetes namespace for the Helm chart installation. If not set, the namespace defaults to the chart resource name.
- [WithHelmChartReleaseName](/reference/api/go/aspire.hosting.kubernetes/withhelmchartreleasename.md) -- `method` - on `KubernetesHelmChartResource` -- Sets the Helm release name for the chart installation. If not set, the release name defaults to the resource name.
- [WithHelmValue](/reference/api/go/aspire.hosting.kubernetes/withhelmvalue.md) -- `method` - on `KubernetesHelmChartResource` -- Sets a Helm value for the chart installation. Values are passed to `helm upgrade --install` via `--set` flags.
- [WithDefaultBackend](/reference/api/go/aspire.hosting.kubernetes/withdefaultbackend.md) -- `method` - on `KubernetesIngressResource` -- Sets the default backend for the ingress. The default backend handles requests that do not match any of the defined routing rules.
- [WithHostname](/reference/api/go/aspire.hosting.kubernetes/withhostname-kubernetesingressresource-string.md) -- `method` - on `KubernetesIngressResource` -- Adds a hostname that this ingress matches. Multiple hostnames can be added by calling this method repeatedly. Path rules without an explicit host apply to each configured hostname. If no hostnames are configured, those rules match all hosts.
- [WithIngressAnnotation](/reference/api/go/aspire.hosting.kubernetes/withingressannotation.md) -- `method` - on `KubernetesIngressResource` -- Adds a Kubernetes metadata annotation to the generated Ingress resource. These are key-value pairs in the `metadata.annotations` field of the K8S Ingress, commonly used to configure ingress controller-specific behavior.
- [WithIngressAnnotationParam](/reference/api/go/aspire.hosting.kubernetes/withingressannotationparam.md) -- `method` - on `KubernetesIngressResource` -- Adds a Kubernetes metadata annotation with a parameter value that will be resolved at deploy time.
- [WithIngressClass](/reference/api/go/aspire.hosting.kubernetes/withingressclass.md) -- `method` - on `KubernetesIngressResource` -- Sets the Kubernetes ingress class name that selects which ingress controller handles this ingress resource.
- [WithIngressClassParam](/reference/api/go/aspire.hosting.kubernetes/withingressclassparam.md) -- `method` - on `KubernetesIngressResource` -- Sets the Kubernetes ingress class name using a parameter that will be resolved at deploy time.
- [WithIngressHostAndPath](/reference/api/go/aspire.hosting.kubernetes/withingresshostandpath.md) -- `method` - on `KubernetesIngressResource` -- Adds a host-scoped path rule to the ingress. The rule matches traffic for the specified host and path, forwarding it to the given endpoint's backing Kubernetes service.
- [WithIngressHostnameParam](/reference/api/go/aspire.hosting.kubernetes/withingresshostnameparam.md) -- `method` - on `KubernetesIngressResource` -- Adds a hostname using a parameter that will be resolved at deploy time.
- [WithIngressPath](/reference/api/go/aspire.hosting.kubernetes/withingresspath.md) -- `method` - on `KubernetesIngressResource` -- Adds a path-based rule to the ingress. The rule matches each hostname configured with `WithHostname`, or all hosts when no hostname is configured, and forwards matching traffic to the endpoint's backing Kubernetes service.
- [WithIngressTlsAuto](/reference/api/go/aspire.hosting.kubernetes/withingresstlsauto.md) -- `method` - on `KubernetesIngressResource` -- Configures TLS termination with an auto-generated secret name derived from the ingress name.
- [WithIngressTlsParam](/reference/api/go/aspire.hosting.kubernetes/withingresstlsparam.md) -- `method` - on `KubernetesIngressResource` -- Configures TLS termination using a parameter for the secret name.
- [WithTls](/reference/api/go/aspire.hosting.kubernetes/withtls-kubernetesingressresource-string.md) -- `method` - on `KubernetesIngressResource` -- Configures TLS for a Kubernetes Ingress using a K8S secret
- [WithAccessMode](/reference/api/go/aspire.hosting.kubernetes/withaccessmode.md) -- `method` - on `KubernetesPersistentVolumeResource` -- Adds an access mode to a persistent volume
- [WithCapacity](/reference/api/go/aspire.hosting.kubernetes/withcapacity.md) -- `method` - on `KubernetesPersistentVolumeResource` -- Sets the requested storage capacity for a persistent volume
- [WithCapacityParam](/reference/api/go/aspire.hosting.kubernetes/withcapacityparam.md) -- `method` - on `KubernetesPersistentVolumeResource` -- Sets a parameterized storage capacity for a persistent volume
- [WithStorageClass](/reference/api/go/aspire.hosting.kubernetes/withstorageclass.md) -- `method` - on `KubernetesPersistentVolumeResource` -- Sets the storage class for a persistent volume
- [WithStorageClassParam](/reference/api/go/aspire.hosting.kubernetes/withstorageclassparam.md) -- `method` - on `KubernetesPersistentVolumeResource` -- Sets a parameterized storage class for a persistent volume
- [WithVolumeAnnotation](/reference/api/go/aspire.hosting.kubernetes/withvolumeannotation.md) -- `method` - on `KubernetesPersistentVolumeResource` -- Adds a Kubernetes metadata annotation to a persistent volume
- [WithVolumeAnnotationParam](/reference/api/go/aspire.hosting.kubernetes/withvolumeannotationparam.md) -- `method` - on `KubernetesPersistentVolumeResource` -- Adds a parameterized Kubernetes metadata annotation to a persistent volume
- [WithNodePool](/reference/api/go/aspire.hosting.kubernetes/withnodepool.md) -- `method` - on `Resource` -- Schedules a compute resource's workload on the specified Kubernetes node pool. This translates to a Kubernetes `nodeSelector` in the pod specification targeting the named node pool.
