Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Websockets do not work with domainmapings by default #13083

Open
georgyo opened this issue Jul 2, 2022 · 6 comments
Open

Websockets do not work with domainmapings by default #13083

georgyo opened this issue Jul 2, 2022 · 6 comments
Labels
area/networking kind/bug Categorizes issue or PR as related to a bug. triage/accepted Issues which should be fixed (post-triage)
Milestone

Comments

@georgyo
Copy link

georgyo commented Jul 2, 2022

What version of Knative?

1.5

Expected Behavior

Websockets to work out of the box when using domain mappings. Especially since websockets work with the default endpoints that are created.

Actual Behavior

Websockets ONLY work with the default auto generated endpoint, and return a 503 when using a domain mapping.

Steps to Reproduce the Problem

This is very similar to #7933, however that focuses on GKE. The problem seems to exist for all installations. In my case, I am using RKE2 on vultr.

The exact service config I am deploying is here: https://gist.github.com/georgyo/846e72c94ed20b4d2988a2f164f31c4b/64742e75d9ea78b63a3af261784beb6e48e2ccaa

This creates two endpoints

They are pointing to the same service, and as such you would expect both to work or neither to work.

@georgyo georgyo added the kind/bug Categorizes issue or PR as related to a bug. label Jul 2, 2022
@nak3
Copy link
Contributor

nak3 commented Jul 2, 2022

Thank you for the report.

@georgyo Are you using net-kourier? If so, you can use DomainMapping with websockets by adding an annotation described in this docs https://github.com/knative-sandbox/net-kourier#tips (Please note that the it still does not work with NodePort as knative-extensions/net-kourier#821)

For other net-* plugins like net-istio, net-contour, I think it does not work yet.

(Note, this issue was tracked by #12601 but it was automatically closed.)

@georgyo
Copy link
Author

georgyo commented Jul 2, 2022

I am using net-istio, and the I can confirm that the snippet in #12601 resolved the issue.

However, I am having trouble grasping why this helps. Specifically, why domainmappings break by default. IE, how/why does the domain mapping change how the request is routed?

In the case of wrtc-star.default.k.fu.io and https://wrtc-star.scalable.io/ both are going to the same istio ingress backed by the same knative service.

The Envoy filter allows http2 connections, but why were they only getting blocked when used a mapped domain?

@dprotaso
Copy link
Member

/triage accepted

@knative-prow knative-prow bot added the triage/accepted Issues which should be fixed (post-triage) label Jul 15, 2022
@dprotaso
Copy link
Member

/area networking

@dprotaso dprotaso added this to the Icebox milestone Jul 15, 2022
@mbaynton
Copy link

mbaynton commented Oct 4, 2022

Voicing support for this issue because I think it's reasonable to expect websockets to work when using net-istio and DomainMappings. That is all that's needed to reproduce.

@georgyo

IE, how/why does the domain mapping change how the request is routed?

I have found through experimentation and through looking at the istio VirtualServices that if you use a DomainMapping, you unfortunately add an additional proxy hop to the data path. I don't know the reason for this, it would certainly be nice if it was just another hostname on the same VirtualService that handled the default domains. But right now DomainMapping is implemented with the proxy backend being the cluster-local service. Requests for them get their Host header rewritten to [svc-name].svc.cluster.local and then envoy forwards them to envoy again. :/

@dao-duc-tung
Copy link

dao-duc-tung commented Nov 17, 2022

For the one who needs a solution on AWS EKS using:

  • knative v1.8.0
  • istio v1.15.3

Below is the envoy filter you need to apply:

apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
  name: allowconnect-istio-ingressgateway
  namespace: istio-system
spec:
  workloadSelector:
    labels:
      app: istio-ingressgateway
  configPatches:
  - applyTo: NETWORK_FILTER
    match:
      listener:
        portNumber: 8081
        filterChain:
          filter:
            name: "envoy.filters.network.http_connection_manager"
    patch:
      operation: MERGE
      value:
        typed_config:
          "@type": "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager"
          http2_protocol_options:
            allow_connect: true

The snippet above is similar to this #7933 (comment). I modified the filter name and typed config to the latest version.

This solution works for both ws and wss when I use cert-manager v1.10.0 to enable auto-TLS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/networking kind/bug Categorizes issue or PR as related to a bug. triage/accepted Issues which should be fixed (post-triage)
Projects
None yet
Development

No branches or pull requests

5 participants