Watch Aspire live streamsDocsTry Aspire
Watch Aspire live streamsDocsTry

KubernetesIngressResource

Classnet10.0
📦 Aspire.Hosting.Kubernetes v13.6.0-preview.1.26478.8
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.
namespace Aspire.Hosting.Kubernetes;
public class KubernetesIngressResource
: Aspire.Hosting.ApplicationModel.Resource,
Aspire.Hosting.ApplicationModel.IResource,
Aspire.Hosting.ApplicationModel.IResourceWithParent,
Aspire.Hosting.ApplicationModel.IResourceWithParent<Aspire.Hosting.Kubernetes.KubernetesEnvironmentResource>
{
// ...
}
ResourceIResourceIResourceWithParentIResourceWithParent<KubernetesEnvironmentResource>

Create an ingress using KubernetesIngressExtensions.AddIngress and configure path rules using KubernetesIngressExtensions.WithPath.

At publish time, the ingress generates a Kubernetes networking.k8s.io/v1 Ingress resource in the Helm chart output with rules derived from the configured paths.

View all constructors
View all properties
var k8s = builder.AddKubernetesEnvironment("k8s");
var ingress = k8s.AddIngress("public")
.WithIngressClass("nginx");
var api = builder.AddProject<MyApi>("api");
ingress.WithPath("/api", api.GetEndpoint("http"));