In our K8s architecture, oauth2-proxy fronts all traffic to Apache Guacamole which streams pixels of a Jupyter notebook to a user's browser.
These are some notes I made to grok what's going on:
oauth2-proxy
Note that it is oauth2-proxy that is the gateway to the outside world.
$ kubectl get ingress
NAME CLASS HOSTS ADDRESS PORTS AGE
jupyter-ingress alb OUR_WEBSITE.click k8s-default-jupyteri-...
...
$ kubectl describe ingress jupyter-ingress
...
Rules:
Host Path Backends
---- ---- --------
OUR_WEBSITE.click
/ oauth2-proxy:4180 (10.0.12.15:4180)
...
$ kubectl describe svc oauth2-proxy
...
Selector: app=oauth2-proxy
Guacamole
With SSO (single sign on) and multiple sessions, we need Guacamole to talk to a database. In our architecture, users do not sign in through Guacamole but KeyCloak. Therefore, Guacamole must trust what oauth2-proxy sends to it.
Note that oauth2-proxy is the only thing that talks directly to Guacamole (see the section above this). You cannot talk to it from the greater internet.
outh2-proxy does this by adding an HTTP header to the user's request. Guacamole looks this up in the database to find the session details. It is not shared with the browser.
The database entry contains the VNC password for that user plus other details.
Jupyter Hub's KubeSpawner puts the VNC password on the pod when it starts. Now, both guacd and VNC can talk to each other for a given user.