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

Ingress not Working With Websocket #793

Closed
JanisOrlovs opened this issue Jul 9, 2019 · 16 comments
Closed

Ingress not Working With Websocket #793

JanisOrlovs opened this issue Jul 9, 2019 · 16 comments
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@JanisOrlovs
Copy link

Hello,
I'm running applications on GKE

kubectl version
Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.1", GitCommit:"b7394102d6ef778017f2ca4046abbaa23b88c290", GitTreeState:"clean", BuildDate:"2019-04-08T17:11:31Z", GoVersion:"go1.12.1", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"13+", GitVersion:"v1.13.6-gke.13", GitCommit:"fcbc1d20b6bca1936c0317743055ac75aef608ce", GitTreeState:"clean", BuildDate:"2019-06-19T20:50:07Z", GoVersion:"go1.11.5b4", Compiler:"gc", Platform:"linux/amd64"}

OS versions: COS

and I have got SpringBoot service with UI built with Vaadin. I have got problem, that websocket is not working thru GCE ingress (same solution works well thru nginx ingress). And I want use IAP for auth.

Current configuration: using GCE ingress, nodeport, backend configs and managed certificates

---
apiVersion: cloud.google.com/v1beta1
kind: BackendConfig
metadata:
  name: my-backend-config
  namespace: preprod
spec:
  timeoutSec: 720000
---

apiVersion: v1
kind: Service
metadata:
  name: ppkebo
  namespace: preprod
  annotations:
    cloud.google.com/app-protocols: '{"portbo":"HTTPS","portboplain":"HTTP"}'
    beta.cloud.google.com/backend-config: '{"ports": {"portbo" :"my-backend-config","portboplain" :"my-backend-config"}}'
spec:
  type: NodePort
  ports:
  - name: portbo
    protocol: TCP
    port: 443
    targetPort: 443
  - name: portboplain
    port: 8090
    targetPort: 8090
  selector:
   app: bo
   environment: preprod

---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: ppkebo
  namespace: preprod
  annotations:
    kubernetes.io/ingress.global-static-ip-name: preprod-ip	
    networking.gke.io/managed-certificates: example-certificate
    kubernetes.io/ingress.class: "gce"
spec:
  rules:
  - host: xx.example.com
    http:
      paths:
      - path: /*
        backend:
          servicePort: portboplain
          serviceName: ppkebo          
---
apiVersion: networking.gke.io/v1beta1
kind: ManagedCertificate
metadata:
  name: example-certificate
  namespace: preprod
spec:
  domains:
  - xx.example.com

From request perspective it looks like this:
image

On nginx ingress it works fine.

@rramkumar1
Copy link
Contributor

@JanisOrlovs Can you please clarify what exact issue you are running into? It's not clear to me from your screenshot.

@JanisOrlovs
Copy link
Author

Hello,
Websocket breaks after 30 seconds

@rramkumar1
Copy link
Contributor

@JanisOrlovs The default setting for backend service timeout is 30 sec so its possible your BackendConfig settings were not applied.

Can you check if there are any K8s events on your Ingress?

@JanisOrlovs
Copy link
Author

Hello,
There are no ingress events only setup certs eg normal events.
How can I check default timeouts? In LBL ui/gcloud console everything all looks as it should

@rramkumar1
Copy link
Contributor

@JanisOrlovs So if you look at the associated Backend Service in the UI, it shows the timeout as 720000?

@JanisOrlovs
Copy link
Author

yes of course

@rramkumar1
Copy link
Contributor

@JanisOrlovs Can you send me an email with your project ID, cluster name and cluster zone? I can take a closer look on our end.

@giladsh1
Copy link

@JanisOrlovs I think you're encountering this issue since you're using the port name and not the actual number (that was the case for me).
try setting the service annotation to something like this -

beta.cloud.google.com/backend-config: '{"ports": {"443" :"my-backend-config","80" :"my-backend-config"}}'

@retpolanne
Copy link
Contributor

@giladsh1 judging by this code, it actually accepts both port name and port number.

@JanisOrlovs can you check the Service events?

@giladsh1
Copy link

giladsh1 commented Oct 3, 2019

@vinicyusmacedo from my testing, I've encountered several issue while using the port name.
specifically, NEG groups didn't work.
see #832 for more info

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 1, 2020
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jan 31, 2020
@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@k8s-ci-robot
Copy link
Contributor

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@masus04
Copy link

masus04 commented Jul 19, 2022

Was there ever a solution to this?

@borisevstratov
Copy link

Was there ever a solution to this?

Yup, there you go:

https://github.com/kubernetes/ingress-gce/tree/b0603c69382a39d097063eab8e3d9e30ca1cdf7b/examples/websocket#change-backend-timeout

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

No branches or pull requests

8 participants