KubernetesGatewayResource Constructors
ClassConstructors1 member
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.
Constructor(string, KubernetesEnvironmentResource) Section titled Constructor(string, KubernetesEnvironmentResource) 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.
public class KubernetesGatewayResource{ public KubernetesGatewayResource( string name, KubernetesEnvironmentResource environment) { // ... }}Parameters
namestringThe name of the gateway resource.environmentKubernetesRemarks
Create a gateway using Kubernetes and configure routes using Kubernetes.
At publish time, the gateway generates a gateway. resource with auto-inferred listeners and one or more HTTP resources in the Helm chart output.
Examples
var k8s = builder.AddKubernetesEnvironment("k8s");var gateway = k8s.AddGateway("public") .WithGatewayClass("azure-alb-external");
var api = builder.AddDotnetProject("api", "../Api/Api.csproj");gateway.WithRoute("/api", api.GetEndpoint("http"));