KubernetesIngressResource
Class net8.0
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>
Remarks
Section titled Remarks Create an ingress using KubernetesIngressExtensions.AddIngress and configure routes using KubernetesIngressExtensions.WithRoute.
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 routes.
Constructors1
Section titled ConstructorsProperties2
Section titled PropertiesIngressClassNameget; setReferenceExpression? Gets or sets the Kubernetes ingress class name that selects which ingress controller will handle this ingress resource.
Parentget Gets the parent Kubernetes environment resource.
Examples
Section titled Examplesvar k8s = builder.AddKubernetesEnvironment("k8s");var ingress = k8s.AddIngress("public") .WithIngressClass("nginx");
var api = builder.AddProject<MyApi>("api");ingress.WithRoute("/api", api.GetEndpoint("http"));