Create an HTTPRoute with Gateway API

If you install Longhorn on a Kubernetes cluster with kubectl or Helm, you can use Gateway API HTTPRoute as a modern alternative to Ingress for exposing the Longhorn UI to external traffic.

Gateway API is the successor to Ingress, offering more expressive routing capabilities and a standardized approach across different implementations.

Prerequisites

  1. Gateway API CRDs installed in your cluster:

    kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.2.0/standard-install.yaml
    
  2. A Gateway controller running in your cluster (e.g., Istio, Envoy Gateway, Cilium, NGINX Gateway Fabric, Traefik, etc.)

  3. At least one Gateway resource deployed and configured

Helm Values Configuration

The following Helm values control HTTPRoute generation:

KeyTypeDefaultDescription
httproute.enabledboolfalseEnables HTTPRoute generation for the Longhorn UI.
httproute.parentRefslist[]List of Gateway references specifying which Gateway(s) should handle this route.
httproute.hostnameslist[]List of hostnames bound to the HTTPRoute.
httproute.filterslist[]List of Gateway API filters to attach to the HTTPRoute rule for the Longhorn UI.
httproute.pathstring"/"The routing path used to access the Longhorn UI.
httproute.pathTypestring"PathPrefix"The path match type. Valid options are "Exact", "PathPrefix", or "RegularExpression".
httproute.annotationsobject{}Key-value annotations to apply to the HTTPRoute resource.

Basic Installation

Install Longhorn with HTTPRoute enabled:

helm install longhorn longhorn/longhorn \
  --namespace longhorn-system \
  --create-namespace \
  --set "httproute.enabled=true" \
  --set "httproute.parentRefs[0].name=my-gateway" \
  --set "httproute.parentRefs[0].namespace=default" \
  --set "httproute.hostnames[0]=longhorn.example.com"

Advanced Configuration

For more complex setups, create a values file:

httproute:
  enabled: true
  parentRefs:
    - name: primary-gateway
      namespace: gateway-system
    - name: secondary-gateway
      namespace: gateway-system
      sectionName: https  # Target specific listener
  hostnames:
    - longhorn.example.com
    - longhorn.example.org
  path: /longhorn
  pathType: PathPrefix
  annotations:
    custom-annotation: "value"

Install with the values file:

helm install longhorn longhorn/longhorn \
  --namespace longhorn-system \
  --create-namespace \
  --values values.yaml

Secure access to Longhorn UI with basic auth integration

To enable authenticated access to the Longhorn UI, reference an existing authentication proxy or middleware resource through the HTTPRoute filters field. The following example assumes a Traefik Middleware resource providing basic authentication is already configured:

httproute:
  enabled: true
  parentRefs:
    - name: primary-gateway
      namespace: gateway-system
    - name: secondary-gateway
      namespace: gateway-system
      sectionName: https  # Target specific listener
  hostnames:
    - longhorn.example.com
    - longhorn.example.org
  filters:
    - type: ExtensionRef
      extensionRef:
        group: traefik.io
        kind: Middleware
        name: oauth-forwardauth
  path: /longhorn
  pathType: PathPrefix
  annotations:
    custom-annotation: "value"

Note: filters is optional for a standard HTTPRoute. Any referenced resource must be configured separately and exist before the HTTPRoute is created.

Install Longhorn using the same values file:

helm install longhorn longhorn/longhorn \
  --namespace longhorn-system \
  --create-namespace \
  --values values.yaml

Verification

  1. Verify the HTTPRoute was created:

    kubectl get httproute -n longhorn-system
    
  2. Check HTTPRoute details:

    kubectl describe httproute longhorn-httproute -n longhorn-system
    
  3. Verify the route is accepted by the Gateway:

    kubectl get httproute longhorn-httproute -n longhorn-system -o jsonpath='{.status.parents[*].conditions}'
    

    The output should show Accepted: True and ResolvedRefs: True.

  4. Access the Longhorn UI through your Gateway’s external IP or hostname.

References


Copyright © 2019-2026 Longhorn a Series of LF Projects, LLC. Documentation Distributed under CC-BY-4.0.


The Linux Foundation has registered trademarks and uses trademarks. For a list of trademarks of The Linux Foundation, please see our Trademark Usage page.


For website terms of use, trademark policy and other project policies please see lfprojects.org/policies.